from getpass import getpass
from fabric.api import *

def change_password(user):
    password = getpass('Enter a new password for user %s:' % user)
crypted_password = crypt(password, 'salt')
Change Unix password from command line over Python/Fabric