LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-22-2008, 03:54 AM   #1
bittus
Member
 
Registered: Aug 2006
Posts: 153

Rep: Reputation: 15
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
 
Old 02-22-2008, 09:43 AM   #2
rayfordj
Member
 
Registered: Feb 2008
Location: Texas
Distribution: Fedora, RHEL, CentOS
Posts: 488

Rep: Reputation: 78
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
or if you have a filename with one username per line:
Code:
for i in $(cat /tmp/users.file); do echo password | passwd --stdin ${i}; done
or more simply set one password and then manually copy the hash from /etc/passwd (or /etc/shadow, if using shadow) and paste it for the remaining;
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:::
user2:$1$O07m28jy$ifVhJIq5NvrQar/ghQ7cg0:13901:0:99999:7:::
user3:$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;

Last edited by rayfordj; 02-22-2008 at 09:45 AM.
 
Old 02-24-2008, 07:46 PM   #3
bittus
Member
 
Registered: Aug 2006
Posts: 153

Original Poster
Rep: Reputation: 15
Thanks a lot buddy. I would try any of these and let u know abt the success. . . . .
 
Old 02-25-2008, 01:29 AM   #4
bittus
Member
 
Registered: Aug 2006
Posts: 153

Original Poster
Rep: Reputation: 15
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
 
Old 02-25-2008, 01:52 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Show use the code... also, don't you mean create 'user' not 'username' ?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem accessing Samba shares simultaneously by multiple users SKYNAT Linux - Newbie 2 01-29-2008 06:25 AM
Multiple Blade servers booting from multiple disk drives simultaneously NGC_cheryl Linux - Enterprise 0 11-26-2007 09:38 AM
How do i give root access to multiple users? bakekelwa Linux - Newbie 14 07-19-2007 12:14 PM
1 cpu and 3 users simultaneously using X packets Linux - Hardware 2 03-25-2007 08:21 PM
Two users on 1 PC simultaneously (with X) technobeast Linux - Newbie 1 07-10-2004 07:24 AM


All times are GMT -5. The time now is 04:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration