Sharing accounts between multiple computers running Ubuntu Linux

For a small environment at home, you can do the same thing without a full-blown Directory Services server like LDAP or NIS.

Simply create user accounts with the same user name, userid and group id on all systems. Pick one system to host home directories, and use autofs on the other system to mount these directories over NFS.

This gives you most of the benefit of directory services without the effort. Maintenance is quite tolerable as long as you keep it down to a few users and a few computers. Once it scales to classroom size, with annual student turnover, you need to move to the directory services level as described so well by quack quixote.


You're referring to directory services. There are several systems that can provide this functionality. DNS is probably the best-known type of directory service; this is how your computer translates domain names (www.example.com) into IP addresses (111.000.111.000).

Hesiod is one of the oldest directory services; it took the DNS concept and applied it to information that changes frequently, like users, groups and passwords. NIS and NIS+ (Network Information Service aka YellowPages/YP, developed by Sun Microsystems) is another system common to many Unixen; LDAP (Lightweight Directory Access Protocol) is a newer system. Microsoft provides a system called Active Directory with Windows Server, and Apple provides a service called Open Directory with OS X Server.

On Unix and Unix-like systems these services are usually configured through the NSS (Name Service Switch) configuration, /etc/nsswitch.conf. You can use any of the systems mentioned earlier; to set them up, you'll need to (a) install the service server; (b) configure the backend database; (c) install the client software; and (d) make sure your nsswitch.conf is configured properly. For example, these lines in nsswitch.conf tell the system to (a) try accessing local files first, and then (b) attempt an LDAP query if the first fails:

passwd: files ldap
shadow: files ldap
group: files ldap
hosts: files ldap

I've asked a related question looking for basic how-to-configure-LDAP instructions, but it's unanswered at the moment. Directory services are more often used in business environments than the home, so Server Fault has a wider variety of questions on most of these systems.