The magic of automounting user homedirectories on Solaris
1. Automounting home on a standalone box
This one is pretty trivial. If you go and check your /etc/auto_master file it should say by default:
+auto_master /net -hosts -nosuid,nobrowse /home auto_home -nobrowse
The second line sets /home as the directory where all auto exported home directories should be mounted to and the file /etc/auto_home as the file which defines which user gets which directory auto exported as a home directory.
So lets check that file now. There are two ways of defining the to be mounted directories here. The easiest is to use the default /export/home directory for all users. To do that, just place the following 2 lines in /etc/auto_home
+auto_home * $HOST:/export/home/&
If you want to finegrain this, you could also do the follwoing:
+auto_home user1 localhost:/export/home/user1 user2 localhost:/export/home/user2
this is especially practical if a user moved homedirs, changed names or whatever.
2. Automounting home to all boxes on a network
Now this one is basically the same as 1., although you will have to change some stuff and do an nfs export first.
So lets start with the assumption that there is a nfs server having all home directories in a classic /export/home infrastructure. Lets assume that the name of that server is “homeserver” and the name of the network is “homenet.net”
To start our nfs share we add the following line to /etc/dfs/dfstab:
share -F nfs -o rw=homenet.net,nosuid, -d "home dirs" /export/home
and execute:
shareall
now on your clients change the auto_home file to look like:
+auto_home * homeserver:/export/home/&
and voila, all magically works.
One note though. Make absolutely sure that all you machines have the same username to userid mapping, meaning that their numerical userid in /etc/passwd is the same on all machines used, and that either DNS is properly setup for your internal network all all hostnames are in each hosts /etc/hosts file.
3. Automounting global zone home to zones
In this scenario we have one problem. NFS from global zone to local zones does not work right. It is slow like a snail and produces absolutely useless overhead. My suggested workaround is to lofs mount /export/home from the global zone to all local zones and do a normal setup like mentioned in variant 1 in every zone.
So for every zone configuration add the following:
global# zonecfg -z my-zone zonecfg:my-zone> add fs zonecfg:my-zone:fs> set dir=/export/home zonecfg:my-zone:fs> set special=/export/home zonecfg:my-zone:fs> set type=lofs zonecfg:my-zone:fs> set options=nodevices zonecfg:my-zone:fs> end zonecfg:my-zone> commit zonecfg:my-zone> exit
with my-zones in this example being the name of your zone.
Afterwards you can treat the now mounted /export/home like a local filesystem inside the zone. But again, make sure that your userid match your usernames on all zones.
Technorati Tags: opensolaris, solaris
Powered by ScribeFire.