[CentOS-devel] Command / utility to encrypt password which can be used for creating user account

Sun Nov 25 00:13:24 UTC 2012
jupiter <jupiter.hce at gmail.com>

Brilliant, that is exactly what I am looking for. Just wondering why $
sudo useradd -c "your user" -m your_user -p "encrypted password" does
not work?

Thank you very much Gianluca.

Cheers.

Jupiter

On 11/24/12, Gianluca Cecchi <gianluca.cecchi at gmail.com> wrote:
>> On Sat, Nov 24, 2012 at 1:00 AM, jupiter wrote:
>>> Is there any command / utility can be used to encrypt a plain
>>> password, then the encrypted password can be used for creating user
>>> account and logging to CentOS 6.2 or CentOS 6.3?
>
>
> An easy method is to use openssl command (MD5):
>
> - run openssl command and type password and its confirmation
>
> $ openssl passwd -1
> Password:
> Verifying - Password:
> $1$mJdspq9o$wZknKGNq433VsXKfK1EAq0
>
> - create the user without specifying password
> $ sudo useradd -c "your user" -m your_user
>
> - change the user (note the single quotes around the encrypted password)
>
> $ sudo usermod -p '$1$mJdspq9o$wZknKGNq433VsXKfK1EAq0' your_user
>
>
> Useful also when a user wants to change his/her password and this way
> can send the sysadmin the encrypted one to run the usermod command
> against.
>
> Gianluca
> _______________________________________________
> CentOS-devel mailing list
> CentOS-devel at centos.org
> http://lists.centos.org/mailman/listinfo/centos-devel
>