Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm responsible for several web servers which all hosts the excact same content. They are all participating in a load balanced setup.

Whenever I need to create a new website on one of these servers, I currently have to create that user on each server. It's rather tedious work.

Now, I could configure LDAP - but it's a bit overkill for this. I would also have to then investigate backup solutions for that as well. I could also use something like Salt, Ansible, Chef or the like...but that requires me to learn yet another very specific "language" just to create a new user now and then.

Isn't there a tool which lets me connect to multiple servers and manage the users and make sure that the users are correctly configured on all servers?

share|improve this question
    
Yes, there is. LDAP. :) Or NIS/YP (which is kind of deprecated). –  SvW Jan 18 '13 at 14:11
    
I would very much like to avoid LDAP. I don't want to mix server roles, so I would have to set up another server for LDAP. Then, to make sure I don't accidentally loose things, I would have to set up yet another LDAP in case the first one goes down. It is both time consuming and quite a setup just to keep user accounts in sync on a few servers. –  sbrattla Jan 18 '13 at 14:16
1  
Depending on the # of users, and assuming the username/pwd is the same, you could probably use millardsoftware.com/puttycs (PuttyCS) to send the commands to create the user down to the servers at once. Just an idea. –  TheCleaner Jan 18 '13 at 14:43
    
@TheCleaner : thanks for your suggestion. I've used tools like pssh and cssh which works fairly well. Still, a tool (gui or the like) which I could just create a user through and have it "implemented" on all servers would be optimal :-) –  sbrattla Jan 18 '13 at 14:49

2 Answers 2

If you don't want to use ldap you could just rsync /etc/passwd, /etc/group, /etc/shadow from one server to the others.

share|improve this answer
    
I've considered that, but issue here is that I'd only like users in a certain UID range to be "common" to all servers. Packages may be installed in different order on the various servers, causing local users to be created with different uids. –  sbrattla Jan 18 '13 at 14:24
    
Then you would need a script that would check the uids and sync only the necessary data around. –  Jure1873 Jan 18 '13 at 14:28
    
Ideally system daemons would use UID's below 500. This should still be an okay approach. –  ewwhite Jan 18 '13 at 14:29
    
The users common to all systems are in the range 5000 and above. So I could sync only users and groups with id > 5000. I could probably find my way around and make a script for that. But I wanted to check if there was something ready made before I went down that path. –  sbrattla Jan 18 '13 at 14:40
1  
USERS="$(awk -F':' '{ if ( $3 >= 1000 ) print $1 }' /etc/passwd)" for u in $USERS; do echo "-user: $u" done –  Jure1873 Jan 18 '13 at 14:45

Assuming you have ssh keys for password-less logins setup, for loops are an easy way to manage this.

for server in server_1 server_2 server_n
do
  useradd foo
done

Definitely dead simple and useful. You can script this to add, remove and check users. It's also possible to be more sophisticated with your uid numbering too, like finding the max number in /etc/passwd and making sure they are all in sync on all the servers.

share|improve this answer
    
Thanks. Good idea. –  sbrattla Jan 18 '13 at 14:47
    
Forgot to mention you could also use pssh or something similar to run the command in parallel, but that may be more complicated than you need. –  AngerClown Jan 18 '13 at 15:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.