How to add new user via shell script
I have to add new user with password using shell script(using only adduser command not useradd), I need to read user name & password from the file.
Thanks for help.
I think the adduser is already a script which uses the useradd command.
I think it quite hard to write a script to use the adduser and not the useradd.
I think python would be nice for this kind of work.
Read a line from file, check the line for errors, use system command IIRC to use the useradd to add the user, read next line of file ...
I use, reading password from the file AddPassword
adduser -g GroupName -h /home/Marad100 Marad100 < /AddPassword
However adding password had been failed.
Changing password for Marad100
Enter the new password (minimum of 5, maximum of 8 characters)
Please use a combination of upper and lower case letters and numbers.
Enter new password:
Re-enter new password:
passwd: The password for Marad100 is unchanged.
How can i add password using adduser ?
Have you tried passwd username ?? It basically prompts you for a new password for the given username without requesting the old one. If the command is written alone will understand you wish to change the username's password pointing in the current shell session.
I should add is a separate command though.
|All times are GMT -5. The time now is 07:06 AM.|