Установка NFS на linux

Хотим сделать сетевую папку на одном ПК и примонтировать ее на другой ПК. Выбираем протокол NFS.

Установить сервер NFS до безобразия просто:

apt install nfs-kernel-server

Далее, создадим d корне диска папку, которую будем расшаривать:

mkdir /backup

Убедитесь, что к созданной папке имеет доступ не только суперпользователь. Или проще, предоставим доступ к папке всем подряд:

chown nobody:nogroup /backup

Далее, отредактируем файл /etc/exports. В этом файле следует прописать кто к каким и какой доступ по NFS будет иметь:

Можете включать столько шар, сколько хотите. Более того. можете делать множественный доступ к одной шаре просто перечисляя тех кому доступ нужен вот так например:

/backup 192.168.1.112(rw,sync,no_subtree_check) 192.168.1.121(ro,sync,no_subtree_check)

При такой настройке все eказанные узлы смогут читать из этой папки, но записывать в нее сможет только узел 192.168.1.112.

Ниже список возможных параметров подключения:

  • ro: specifies that the directory may only be mounted as read only
  • rw: grants both read and write permissions on the directory
  • no_root_squash: is an extremely dangerous option that allows remote “root” users the same privilege as the “root” user of the host machine
  • subtree_check: specifies that, in the case of a directory is exported instead of an entire filesystem, the host should verify the location of files and directories on the host filesystem
  • no_subtree_check: specifies that the host should not check the location of the files being accessed withing the host filesystem
  • sync: this just ensures that the host keeps any changes uploaded to the shared directory in sync
  • async: ignores synchronization checks in favor of increased speed

Добавляем шару в список доступных для NFS:

exportfs -a

Проверим список доступных на данный момент ФС:

showmount -e

Ссылки:

https://linuxconfig.org/how-to-set-up-a-nfs-server-on-debian-10-buster

<a href=”https://adminunix.ru/podnimaem-nfs-na-debian/” data-type=”URL” data-id=”https://adminunix.ru/podnimaem-nfs-na-debian/” target=”_blank” rel=”noreferrer noopener”>https://adminunix.ru/podnimaem-nfs-na-debian/</a>

Оставьте ответ

Ваш адрес email не будет опубликован.

WC Captcha 45 ÷ 5 =