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

Gianluca Cecchi gianluca.cecchi at gmail.com
Sat Nov 24 09:32:39 UTC 2012


> 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


More information about the CentOS-devel mailing list