On Fri, 2003-08-29 at 12:06, James D. Parra wrote:
> Hello,
> 
> I want to create an fstab entry that will mount /home on a remote machine
> upon boot-up with an $USER entry so any user who logs into the workstation
> will have their "home" directories on an single system.
> 
> Does anyone know if this can be done and, if so, what is the proper syntax?
> 
> Many thanks in advance.
> 
> James

I use a form of this ... however in my case the environment is a mixed
one so what I do is have a small local home dir on the box so that local
.kde .openoffice etc is there (to match what is on that Distro/release
number) This way I never have kde3 trying to use kde2 config files etc
etc.  Then I create a dir inside the users home calle d mydata.  This
becomes my mount point.

I then use a program called shfs.  Nicer than NFS or the like since it's
a lot more robust and secure.  It's actually using ssh as the protocol. 

http://shfs.sourceforge.net/  

Follow the instructions on the website to build the modules.

Then what I had to do was create the RSA key for the user so that they
would use key authentication for ssh logins instead of username password
(you could do either but this is much easier for the user once running)
Once done.  

Then I created the following fstab entry.

[EMAIL PROTECTED]:22/home/james /home/james/mydata shfs
umask=000,users,noatime,noauto,rw,exec 0 0

(all one line and xxx is the IP number of the box to be logged into)

Now whenever I turn on my box, and there is a network connection.  These
directories are automounted and I'm able to use the same data directory
wherever I am.  ssh has the advantage that it handles things like
disconnects and no network much cleaner than NFS (it doesn't lock up my
box or hang bootup if it can't get out on the net.  In fact if it can't
get to the net it just goes "ok" and continues.  Then I wrote a little
connect script for usage when I wasn't connected at boot but want to be
connected now.

#!/bin/sh
cat /proc/mounts | grep remotehome | awk '{ printf($3) > "/tmp/var" }'
        if [ -f /tmp/var ]; then
                read var < /tmp/var
                        if [ "$var" == "shfs" ]; then
                                rm -f /tmp/var
                                exit 0
                        fi
                else
                        ping -c 3 yahoo.com > /dev/null 2> /dev/null
                                if [ $? = "0" ]; then
                                        /bin/mount /home/james/mydata
                                else
                                        exit 0
                                fi
        fi


This way it tests for the network.. and connects.  (hopefully the script
is right... seems to work ok so far.)  Finally I changed shfsmount and
shfsumount (created by shfs) setuid root so that mounting could be done
by the user.  One thing I added was the use of compression on ssh to
speed things up, this gets turned on in the ssh config files in /etc on
both ends.

James




Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to