Hi,
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?
Thank you.
Kind regards.
Jupiter
On Sat, Nov 24, 2012 at 1:00 AM, jupiter jupiter.hce@gmail.com 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?
man useradd
or I didn't understand your question...
-- Gianluca Sforna
http://morefedora.blogspot.com http://identi.ca/giallu - http://twitter.com/giallu
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
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@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@centos.org http://lists.centos.org/mailman/listinfo/centos-devel
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@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@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@centos.org http://lists.centos.org/mailman/listinfo/centos-devel
CentOS-devel mailing list CentOS-devel@centos.org http://lists.centos.org/mailman/listinfo/centos-devel
Actually it is off topic for this particular mailing list.... Anyway: 1) your command is ok if you use single quotes when directly putting the encrypted string instead of double quotes
$ sudo useradd -c "your user" -m your_user -p 'encrypted password'
2) or you could use what sugggested by Banyan using command substitution ( `...` or the more Posix compliant and readable $(...) mechanism) that works instead with double quotes
Gianluca
Thanks very much for Gianluca and all responses and my apolory for the off topic.
Cheers.
On 11/26/12, Gianluca Cecchi gianluca.cecchi@gmail.com wrote:
Actually it is off topic for this particular mailing list.... Anyway:
- your command is ok if you use single quotes when directly putting
the encrypted string instead of double quotes
$ sudo useradd -c "your user" -m your_user -p 'encrypted password'
- or you could use what sugggested by Banyan using command
substitution ( `...` or the more Posix compliant and readable $(...) mechanism) that works instead with double quotes
Gianluca _______________________________________________ CentOS-devel mailing list CentOS-devel@centos.org http://lists.centos.org/mailman/listinfo/centos-devel
2012/11/26 jupiter jupiter.hce@gmail.com
Thanks very much for Gianluca and all responses and my apolory for the off topic.
or you can use the 'hashlib' in python to create a crypted password.