How to create encrypted password via command line

Caetano, Greg Greg.Caetano at hp.com
Wed Sep 12 14:27:55 UTC 2007


Anne:

Here is an example out of a RHEL4 manual... Look at the simply python
code in the "Warning" section that helps you set an initial password for
a user

http://www.redhat.com/docs/manuals/RHEL-4-Manual/en-US/System_Administra
tion_Guide/s2-redhat-config-users-passwd-aging.html

==========================
To assign an initial password, use the following steps: 
Start the command line Python interpreter with the python command. It
displays the following: 

Python 2.4.3 (#1, Jul 21 2006, 08:46:09) [GCC 4.1.1 20060718 (Red Hat
4.1.1-9)] on linux2 Type "help", "copyright", "credits" or "license" for
more information. >>>
                  
At the prompt, type the following commands. Replace <password> with the
password to encrypt and <salt> with a random combination of at least 2
of the following: any alphanumeric character, the slash (/) character or
a dot (.): 

                    import crypt; print
crypt.crypt("<password>","<salt>")
                  
The output is the encrypted password, similar to '12CsGd8FRcMSM'. 

Press Ctrl-D to exit the Python interpreter. 

At the shell, enter the following command (replacing
<encrypted-password> with the encrypted output of the Python
interpreter): 

                    usermod -p "<encrypted-password>" <username>
                  
Alternatively, you can assign a null password instead of an initial
password. To do this, use the following command: 

              usermod -p "" username

======================================
Greg Caetano
greg.caetano at hp.com

-----Original Message-----
From: redhat-list-bounces at redhat.com
[mailto:redhat-list-bounces at redhat.com] On Behalf Of Anne Moore
Sent: Wednesday, September 12, 2007 8:04 AM
To: redhat-list at redhat.com
Subject: How to create encrypted password via command line

Hi All
 
Does anyone know of a quick/painless way to create an encrypted {crypt}
password via the command like on Red Hat? I need my users to do this and
I don't want them to have to write much syntax, etc., as that will be
too much for them. I was hoping there was some built-in (or other)
method that allows creating an encrypted password, depending on what the
user types in for the password.
 
Thank you!
 
Anne




More information about the redhat-list mailing list