Linux learning summary (four) nfs server construction

Nfs stands for net file system, which allows computers on the network to share resources through the tcp/ip network.

installation

sudo apt-getinstall nfs-kernel-server

Configuration

If you want to create a shared directory, such as: /home/gt
Open the configuration file: sudo vi /etc/exports
write the absolute path of the shared directory and the corresponding permissions, for example:
/home/gt(ro,sync,no_root_squash)

  • ro: read-only access
  • rw: read and write permissions
  • sync: data is synchronously written to the memory and hard disk
  • async: The data will be temporarily stored in the memory, rather than directly written to the hard disk
  • no_root_squash: Log in to the nfc host. When using the shared directory, it is equivalent to the owner of the directory. If it is root, then he has root privileges for the shared directory. This number is extremely insecure and is not recommended.
  • root_squash: Log in to the nfs host. When using the shared directory, it is equivalent to the owner of the directory, but if the shared directory is used as root, the permissions of this user (root) will be compressed and become an anonymous user, that is Usually his UID and GID will become the identity of nobody
  • all_squash: Regardless of the identity of the user who logs in to nfs, his identity will be compressed into an anonymous user, usually nobody

After the configuration is complete, the nfs server must be restarted:
sudo service nfs-kernel-server restart

Client connection

Client access to the shared directory:
mount + IP: shared directory name mount directory
sudo mount 192.168.152.130:/home/gt /mnt
cd to the machine's /mnt directory, you can use the cp command to get all the files in the directory

Guess you like

Origin blog.csdn.net/bureau123/article/details/111760717