Difference between revisions of "Sharing Files Remotely"
m (moved Sharing Files to Sharing Files Remotely: needs a bit more detail, or it could be about sharing files between users locally)
m (Bot: Removing from Category:HOWTOs (English))
|Line 2:||Line 2:|
== NFS ==
== NFS ==
Revision as of 18:19, 10 June 2011
Using NFS in Arch only requires installing portmap and nfs-utils; most of the NFS functionality has already been compiled into the kernel. As FUBAR suspected, the uid's for user robert were different on the two machines: uid=1000 in Arch and uid=1001 in Xandros. In NFS, I got around that by putting 'no_root_squash' in the export directives in /etc/exports, i.e.
/ hostname_DT(rw,no_root_squash,subtree_check) /home hostname_DT(rw,no_root_squash,subtree_check) /mnt/sda5 hostname_DT(rw,no_root_squash,subtree_check) /mnt/sda7 hostname_DT(rw,no_root_squash,subtree_check)
Using NFS, one also has to add lines in /etc/hosts.allow for each of the daemons and programs used by NFS, specifying which hosts are allowed to use these services, e.g. in my case for portmap
portmap: 192.168.0.5, 192.168.0.7 # you have to use IP addresses!
and the same for nsfd, nfslock, lockd, rquotad, mountd, statd, mount, umount. In Xandros, two of these have different names: rpc.nsfd and rpc.mountd.
Also, to use NFS in Arch one has to add the services portmap, nfslock, nfsd to the DAEMONS line in /etc/rc.conf, e.g. right after network. Finally, I have to stop the firewalls on both machines when I want to use NFS. After doing all of that, I can use Konqueror as user robert to access all filesystems on the respective server (DT or LT) from the other machine as a client except for /home/robert and /mnt/sda7/home/robert (that's a Slackware install) on LT; for these I have to use Konqueror as root on DT.
Using FISH is very simple. Remote filesystems don't have to be mounted, and the only thing that's required is that the sshd service is running on the file server. I.e. in Arch one has to install openssh and put the service sshd in the DAEMONS line in /etc/rc.conf. Firewalls must be stopped to set up the connection but once the connection is established it looks as though one can restart the firewalls.
One should also add a line in /etc/hosts.allow for the hosts that are allowed to use sshd, i.e.
sshd: 192.168.0.5, 192.168.0.7 (or sshd: ALL )
and comment out the line ALL: ALL: DENY in Arch's /etc/hosts.deny.
Once this is done, all that's needed to access the root filesystem of the server is to enter 'fish://root@hostname/' in the URL field of Konqueror as an ordinary user, followed by the root password.
The drawback of FISH is that one is frequently asked for the password but I suppose one can avoid that by using SSH keys.
SHFS needs to be installed and configured on the client side, not on the server side. The server only needs to have a working sshd running. If you run Arch as a client, install shfs in it (pacman -S shfs) and make sure sshd is running on the server and firewalls are stopped.
Next, create a mount point for the remote filesystem, e.g.
# mkdir -p /mnt/shfs
Set the suid bit on /usr/bin/shfsmount and /usr/bin/shfsumount if you wish to enable all users to mount (umount) remote dirs using shfs. You can do this in Konqueror or by running
# chmod u+s /usr/bin/shfsmount # chmod u+s /usr/bin/shfsumount
so that the permissions are: -rwsr-xr-x root root.
Then mount the remote shell filesystem:
# shfsmount root@remote_hostname:/ /mnt/shfs -o uid=robert
(or you can use # mount -t shfs root@remote_hostname:/ /mnt/shfs -o uid=robert)
Using the option -o uid=robert got me around the mismatch of uid's for robert on the two systems.
At the 'root@remote_hostname's password:' prompt enter root's password. You're ready then to access the remote filesystem as user robert at /mnt/shfs, even after the remote firewall is restarted.
As with FISH, so with SHFS, it seems to be necessary that a line is added in /etc/hosts.allow for the hosts that are allowed to use sshd, i.e.
sshd: 192.168.0.5, 192.168.0.7 #(or sshd: ALL )
and that the line ALL: ALL: DENY in Arch's /etc/hosts.deny is commented out or removed.
I'm still a newbie with file sharing on Arch (and non-Arch Linux). Forgive me if the above comes across as somewhat amateurish.
note by cheer: forked from thread http://bbs.archlinux.org/viewtopic.php?id=26926