Give password simultaneously for multiple users
hi every1,
I would like to duplicate present users of a Linux box into another one. I created the users using a shell script. Now can anyone suggest an idea to give same password for all the users simultaneously. (Like all users have the same password and they will change it according to their wish later) Thanks in advance |
if you just want them to all have the same password you could run through a for loop.
something like: Code:
for i in user1 user2 user3 user4; do echo password | passwd --stdin ${i}; done Code:
for i in $(cat /tmp/users.file); do echo password | passwd --stdin ${i}; done this isnt very secure (if anyone can read the shadow file they can clearly see that the hashes are the same so identifying the password for one users opens it up for all users) but then again, neither is setting the same password for multiple users. however, it does very from situation to situation as to what you do and why you decide to do it. Code:
user1:$1$O07m28jy$ifVhJIq5NvrQar/ghQ7cg0:13901:0:99999:7::: you may even be able to modify your shell script used to create the users to modify the password as well depending on its structure and design. I'm sure there are any number of other possible ways to accomplish this same task; some more easily and some more robust/complex; |
Thanks a lot buddy. I would try any of these and let u know abt the success. . . . .
|
Now i hav another quewry.
I hav a file with usernames and another with corresponding userids. I tried a script to create user by accepting username from one file and corresponding id from the other, but the loop executes infinitely. Can any1 help me to create username from both. Thanks |
Show use the code... also, don't you mean create 'user' not 'username' ?
|
All times are GMT -5. The time now is 12:06 PM. |