Saturday 15 December 2012

How to create Linux user account with password

To create Linux user account with password the following command will be useful:

1. useradd -m -p encryptedPass username

I know at least two ways to get password encrypted. The first one is to use perl crypt(); function:

perl -e 'print crypt("password_to_be_encrypted", "salt"),"\n"'

which will give you an output sa3tHJ3/KuYvI.

2. The second way (more simple) is to use command:
 
openssl passwd password_to_be_encrypted

#################################################

Syntax:#useradd -m -p `openssl passwd $PASSWD` $USER 

 #useradd -m -p `openssl passwd  sankar(password)`    shan(username)

#grep san /etc/shadow

 

No comments:

Post a Comment