Difference between revisions of "Sharing Files Remotely (Русский)"

From ArchWiki
Jump to navigation Jump to search
(redirect as English page)
(17 intermediate revisions by 11 users not shown)
Line 1: Line 1:
#redirect [[Category:Network_sharing_(Русский)]]
== NFS ==
Для использования NFS в Archlinux требуются установленные пакеты portmap и nfs-utils, бОльшая часть функциональности NFS уже содержится в ядре. Как подозревал FUBAR, идентификатор пользователя robert различается на двух машинах: uid=1000 на Arch и uid=1001 на Xandros. В NFS, я обошел это вставляя 'no_root_squash' в директивы экспорта /etc/exports, например:
/        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 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)
Используя NFS, также необходимо добавить строки в /etc/hosts.allow для некоторых демонов и программ, используемых NFS, специфичных адреса допущенные к использованию этих сервисов, например, для portmap:
portmap:,            # здесь должны использоваться IP адреса!
и тоже самое для nsfd, nfslock, lockd, rquotad, mountd, statd, mount, umount. На Xandros, эти два имеют различные имена: rpc.nsfd и rpc.mountd.
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:,            # 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.
Так, для использования NFS в Archlinux необходимо добавить сервисы portmap, nfslock, nfsd в строку DAEMONS файла /etc/rc.conf, например, правее (после) network. В заключении, я отключил файервол на двух машинах, когда захотел использовать NFS. После всего сделанного, я могу использовать Konqueror как пользователь robert для доступа ко всем файловым системам на соответсвующем сервере (DT или LT) с другой машины как клиент исключая /home/robert и /mnt/sda7/home/robert на LT; для них я должен использовать Konqueror как пользователь root на DT.
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.
== FISH ==
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:,      (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 ==
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:,      #(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:
вынесено с ветки форума http://bbs.archlinux.org/viewtopic.php?id=26926

Latest revision as of 19:13, 26 November 2017