LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   creating multiple user in multiple linux boxes from single remote host (https://www.linuxquestions.org/questions/linux-newbie-8/creating-multiple-user-in-multiple-linux-boxes-from-single-remote-host-901557/)

niaz_ph 09-07-2011 04:47 AM

creating multiple user in multiple linux boxes from single remote host
 
Hi,

I have 30 remote hosts. I use to use ssh to login remotely to those linux servers. Now i need to create an extra username and password to all of those 30 hosts. Manually it takes time to login each host and creating username and password.

I need to ask is there any tool so that i can create username and password in those required 30 hosts at a time from my remote pc ? Or is there any fruitful solution available ?

TB0ne 09-07-2011 08:47 AM

Quote:

Originally Posted by niaz_ph (Post 4463732)
Hi,
I have 30 remote hosts. I use to use ssh to login remotely to those linux servers. Now i need to create an extra username and password to all of those 30 hosts. Manually it takes time to login each host and creating username and password.

I need to ask is there any tool so that i can create username and password in those required 30 hosts at a time from my remote pc ? Or is there any fruitful solution available ?

If you already have one user set up with the password you want, look in the /etc/shadow file for that user, and *ALL* the text between the first two colons ":" is the encrypted password.

From the command line, you can do:
Code:

ssh <user>@<remote system> "sudo useradd -c comment -m -d /home/username -p <encrypted password from above>"
So, a shell-script could loop through all 30 quickly, and shove a user in. You could also just up-arrow the command, change the remote machine address, and press ENTER too. 30 systems would take you less time than writing a script, or posting in a forum.

niaz_ph 09-10-2011 12:34 PM

Quote:

Originally Posted by TB0ne (Post 4463884)
If you already have one user set up with the password you want, look in the /etc/shadow file for that user, and *ALL* the text between the first two colons ":" is the encrypted password.

From the command line, you can do:
Code:

ssh <user>@<remote system> "sudo useradd -c comment -m -d /home/username -p <encrypted password from above>"
So, a shell-script could loop through all 30 quickly, and shove a user in. You could also just up-arrow the command, change the remote machine address, and press ENTER too. 30 systems would take you less time than writing a script, or posting in a forum.

Hi,
Thanks for the info....Actually i want to create username and password to 30 remote hosts. each host contains different ip. i want to create for example user: linux and password: 12 to those 30 hosts at a time ... Is it possible without creating the username and password manually ?

TB0ne 09-12-2011 03:48 PM

Quote:

Originally Posted by niaz_ph (Post 4468265)
Hi,
Thanks for the info....Actually i want to create username and password to 30 remote hosts. each host contains different ip. i want to create for example user: linux and password: 12 to those 30 hosts at a time ... Is it possible without creating the username and password manually ?

Yes...I told you how above, and even gave you the command to do it.

Again, put the command into a script to loop through all 30 addresses/names, and execute it. That's it. I'm still confused, though, since you could have easily created all the users manually in far less time than it took to post the question and follow-up here.


All times are GMT -5. The time now is 11:17 AM.