I ask for your help to create a script to create a user and a password on 1 click
useradd client1 -M -s /bin/false
passwd client1
To have for instance a new user with:
login: client1 password: test
Is it possible ? and if it is, how please ?
This should do:
adduser client1 -p $(perl -e'print crypt("test", "aa")')
man useradd will give you hints to do this and I believe this is how:
useradd [username] -d /path_to_home_directory -p [encrypted_password]
now, VERY IMPORTANT, the documentation for useradd says that the -p parameter expects the password ENCRYPTED as returned by crypt(7); therefore, what you need to do is create a sample user with password "test" for example, then open up /etc/shadow and copy and paste the password from the file and use it on your script.
Suppose that "test" encrypted in /etc/shadow appears as "zxs1@431sa" your final script should be:
useradd [username] -d /path_to_home_dir -p zxs1@431sa [enter]
That should do it, I think.
References: http://linux.die.net/man/8/useradd