Skip to content

Instantly share code, notes, and snippets.

@foolishflyfox
Created December 25, 2018 07:24
Show Gist options
  • Save foolishflyfox/80844e974d243eb63f4b9a1d5246c9d0 to your computer and use it in GitHub Desktop.
Save foolishflyfox/80844e974d243eb63f4b9a1d5246c9d0 to your computer and use it in GitHub Desktop.
Edit files of a directory in remote server with NFS

Server Operations

Install nfs server

$ sudo apt-get update
$ sudo apt-get install -y nfs-kernel-server

Config nfs

$ sudo echo "/home/linux_fhb/NfsEdit *(rw,sync,no_root_squash)" >> /etc/exports
  • /home/linux_fhb/NfsEdit: the directory you want to export
  • *: all pc can visit this directory, you can also set like "10.0.2.0/24"
  • (rw,sync,no_root_squash): set file permission

Restart nfs Server

$ sudo /etc/init.d/rpcbind restart
$ sudo /etc/init.d/nfs-kernel-server restart

Change directory mode

$ chmod o+x /home/linux_fhb/NfsEdit

We visit this directory through nfs with user name dialout

Client Operation

Check NFS

$ showmount -e 192.168.1.250

Mount directory

$ sudo mount -o resvport sihua:/home/linux_fhb/NfsEdit ./SihuaEdit

if you want unmount the directory, just run :

$ sudo umount ./SihuaEdit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment