I think this is what you need:

    pwd_hash_cmd = 'openssl passwd -1 -salt shaker "%s"' % password
    pwd_hash = run_cmd(pwd_hash_cmd).strip()

    cmd = 'useradd %s -m --password %s --gid %s --groups %s'
    run_cmd(cmd % (user, pwd_hash, user_group, extra_user_groups))

On Wed, Jun 5, 2013 at 4:42 PM, Tim Burby <[email protected]> wrote:
> Hi All,
> I am new to fabric but I'm really appreciating the power. I'm a middling sys 
> admin with sudden responsibility for about 50 servers. the Environment is 
> currently handled machine by machine for authentication. How can I pass a 
> hashed password to either useradd or usermod?
> I tried sudo("usermod -p 'wholebunchofhashstuff' jsmith") and sudo("usermod 
> -p \'wholebunchofhashstuff\' jsmith" but both have failed. and would there  
> be a way to pass the hash in from a command option? I've combed the web as 
> best as I can but pure sys admin examples are never as full as I'd like.
>
> Thanks
>
> Tim
> _______________________________________________
> Fab-user mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/fab-user



-- 
Andrés Riancho
Project Leader at w3af - http://w3af.org/
Web Application Attack and Audit Framework
Twitter: @w3af
GPG: 0x93C344F3

_______________________________________________
Fab-user mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to