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

Banyan He banyan at rootong.com
Sun Nov 25 09:47:28 UTC 2012


You can save your ass from a combination,

useradd -c <user_name> -m <user_name> -p "`openssl passwd -1`"

------------
Banyan He
Blog: http://www.rootong.com
Email: banyan at rootong.com

On 2012-11-25 8:13 AM, jupiter wrote:
> 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
>>
> _______________________________________________
> CentOS-devel mailing list
> CentOS-devel at centos.org
> http://lists.centos.org/mailman/listinfo/centos-devel
>



More information about the CentOS-devel mailing list