lunedì 12 gennaio 2009

Crypt password with Python cm interpreter

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.2.2 (#1, Dec 10 2002, 09:57:09)
[GCC 3.2.1 20021207 (Red Hat Linux 8.0 3.2.1-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

- At the prompt, type the following (replacing password with the password to encrypt and salt with a combination of exactly 2 upper or lower case alphabetic characters, digits, the dot (.) character, or the slash (/) character such as ab or 12:

import crypt; print crypt.crypt("password","salt")

- The output is the encrypted password similar to 12CsGd8FRcMSM. Type [Ctrl]-[D] to exit the Python interpreter.

Cut and paste the exact encrypted password output, without a leading or trailing blank spaces, into the following command:

usermod -p "encrypted-password" username

Nessun commento:

Posta un commento