All proceeds from Ad Clicks goes to the author of this site.

 

Tuesday, February 08, 2005

You’re never far from home


If you are new to Solaris and tried creating a user or even a directory in /home, you were probably surprised that it’s not alowed, because the automounter owns /home. Okay your first thoughts are probably how I can get rid of the autoloader It’s a very cool once you learn how to configure it and create a user properly. There are two steps, the first is




useradd <username>

mkdir /export/home/<username>

chown –R <username> /export/home/<username>


You can add the arguments of your choice .i.e. pick the shell you want, and
UID you want. The second step is to create an entry in /etc/auto_home which is done like this



echo “<username> <host>:/export/home/<username>” >> /etc/auto_home


Okay that will get you a working user account, and after you log in it will appear that your data is in /home/username. It seems like a lot of work for nothing, right? Well there are many things that the automount system makes cooler. What if you have more than one machine, and you want to share home directories between all of them, it’s easy and more secure with Solaris. Just follow the directions that follow, once its setup adding remote users is even easier than local ones. “The Computer is the Network” really comes into play here.


SETTING UP THE SERVER BOXES


Here are the commands, to set up the servers to share home directories.


Solaris: (I’m assuming NFS is configured)



echo “share -F nfs -d "home directories" export/home” >> /etc/dfs/dfstab

shareall


Linux: (I’m assuming you have a working DNS or /etc/hosts properly setup and NFS is started)



echo “/home client1 (rw,async) client2 (rw,async)”
>> /etc/exports

exportfs –av


(replace client1 and client two with the names of the boxes users will log into)


SETTING UP A CLIENT BOX that has a remote home directory.


Now here is where it gets simple, down from 4 lines down to, just two



useradd <username>


Linux: (remote server)



echo “<username> <remote_hostname>:/home/<username>” >> /etc/auto_home


Solaris: (remote server)



echo “<username> <remotehostname>:/export/home/<username>” >> /etc/auto_home


CONCLUSION:


Note the automounter doesn’t mount all the directories just ones of the users
that are logged in. Of course you could install NIS+, LDAP, or SunONE but those are big and have a lot of overhead, and probably too much for a small business or home user. With 3 or 4 boxes, this solution will allow you to configure once run everywhere, of course you will need to deal with different environments if you share the same home directory between a Linux and Solaris box but I will leave you to deal with that. Passwords won’t be shared unfortunately, but I’m sure you could create a system to update all passwords of your users at once if you want to.