Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to share folders between PCs on a local network, which may have different Linuxes installed (or booted from a USB key). Thus, I do not want to count on the sharing capabilities of a given file manager (like nautilus), because some PCs on the network may have a given file manager – some may not!

Some of these PCs on the local network may have broken keyboards, and have only a mouse available – and it would be quite tedious to type all the needed commands using the mouse on a virtual keyboard.

I am aware that there exists system-config-nfs for Fedora (from CentOS / Redhat: Setup NFS v4.0 File Server (cyberciti.biz)):

system-config-nfs

... but:

  • This looks like only covering Server setup – I want to set up the Client as well
  • I often use Ubuntu, and it doesn't look like system-config-nfs is present in Ubuntu repositories (not sure if a compatible package may be present in Debian repositories, though)

If system-config-nfs cannot configure clients, is there any other way I can manage both NFS Server and Client-side configuration on multiple machines through a GUI - without connecting to each individually from the command line?

share|improve this question
add comment

1 Answer

Well, I did manage to find one tool, that offers a GUI for both server and client NFS setup, and it is Webmin, a "web-based interface for system administration for Unix". Here are some clickable screenshots:

Server setup GUI screenshots

(s0) server_00 (s1) server_01 (s2a) server_02a (s2b) server_02b (s3) server_03

Client setup GUI screenshots

(c0) client_00 (c1) client_01 (c2a) client_02a (c2b) client_02b (c3) client_03

However:

  • Being web-based, it demands that a JavaScript (and SSL) capable browser is installed on both client and server computers
  • Being a system-administration tool, it contains a lot more options than just NFS setup, so it can be difficult to get an instant overview of it

Also, note I don't know enough about NFS to setup proper security, which is why my goal is to setup shares for a local network quickly with no security; do a job; and then tear down the NFS sharing just as quickly. This and the above two reasons are why I was hoping I could track down a GUI that is simpler (e.g. written in Python/Tkinter, and for NFS only); but at least webmin offers both server and client GUI setup, which is the most important for me to begin with (so I'm spared of dealing with NFS internals as much as possible).

I've made a test on Ubuntu 11.04 PC (proper install) as server and Ubuntu 12.04 PC (live image based on Mini Remix ISO) as client; and besides the installation of webmin and dependencies being not exactly trivial - it's also not exactly trivial to use it to setup NFS. Which is why I will take the liberty to post my notes here, in a sort of a tutorial format - hope that's OK.


First, the usage. Note that in NFS (webmin?) parlance:

  • The PC sharing a folder on the network is the server, and its shared folder is known as an "NFS Export"
    • All folders thus exported, in case of NFS 4, will be set under one (or more) "NFSv4 Pseudofilesystem" root(s)
  • The PC accessing a network shared folder is the client, and the accessed network folder is known as an "NFS Share"

Server NFS sharing setup

  • Create a directory to be shared, e.g. /tmp/sharetest
  • In webmin, visit https://127.0.0.1:10000, and login with an account that is a sudoer
  • After login, expand the "Networking" node in the left frame (requires JavaScript) (s0) and click on "Networking"/"NFS Exports" (s1)
  • On the subsequent "NFS Exports" page, click on "Add a new export" (s1)
  • On the next page, "Create Export", keep "NFS version" on 4, and click on the ... button at the "Directory to export" field, and navigate to (with doubleclick) - and choose - the /tmp/sharetest directory (s2a)
  • Back on the "Create Export" page, you may want to set "Read-only?" to "No", and otherwise keep the defaults - finally click on "Create" button (s2b)
  • The "NFS Exports" page is shown again, with two new entries, /export and /export/sharetest (s3)
  • Note here that /export is an automatically created "NFSv4 Pseudofilesystem" root
    • If creating additional NFS exports, they can either use this pseudofilesystem root - or ask for a creation of a new one

Note that here, if you want to edit the NFS exports, there may be buggy GUI behavior for NFS v4 - for which I've filed a bug: Webmin / Bugs / #4286 NFS v4 exports do not persist as v4 upon edit - they revert to v3; and NFS Version help missing. The changes made to the NFS exports here, are reflected in the file /etc/exports. Note that setting "Read-only?" (which is the rw option in /etc/exports) to "No" is not enough to allow the clients to write in the directory - you must also make /tmp/sharetest world writable, using chmod 777 (see ref [3]); also note that files written by clients will preserve the writers' uids - you should check whether that introduces problems for you.

Client NFS sharing setup

  • Create a local directory which will be mapped to the network share, e.g. /tmp/nfsshare
  • In webmin, visit https://127.0.0.1:10000, and login with an account that is a sudoer
  • After login, expand the "System" node in the left frame (requires JavaScript) (c0) and click on "System"/"Disk and Network Filesystems" (c1)
  • On the subsequent "Disk and Network Filesystems" page, select "Network Filesystem v4 (nfs4)" from the dropdown, and click on the "Add mount" button (c1)
  • On the next page, "Create Mount", click on the "..." button next to the "NFS Hostname" textfield (which initially says "mount") (c2a:1)
  • A new window "Choose NFS Server" will popup; the NFS server should be autodetected if it is running - so click on the link under "IP Address" column (c2a:2), which will populate the "NFS Hostname" textfield with the corresponding "Hostname"; and close the popup
  • Back on the "Create Mount" page, click on the "..." button next to the "NFS Directory" textfield (c2a:3)
  • A new window "Choose NFS Directory" will popup; the exports should be listed - however note that "For an NFSv4 mount, you should select '/'" - so click on / link under "Directory" column (c2a:4), which will populate the "NFS Directory" textfield with the corresponding "Directory" - or just close the popup to leave the default / unchanged
  • Back on the "Create Mount" page, click on the "..." button next to the "Mounted As" textfield (c2a:5)
  • A new window "Choose Directory" will popup; navigate to and choose the /tmp/nfsshare directory, and click OK (c2a:6)
  • Back on the "Create Mount" page, you may want to set "Read-only?" to "No", and otherwise keep the defaults - finally click on "Create" button (c2b)
  • Once back on the "Disk and Network Filesystems", you should see the new share being listed in the table (c3)
  • To check that everything is OK, you can try listing the /tmp/nfsshare directory (c3) - or writing into the /tmp/nfsshare/sharetest directory

Note that, if by accident you close down the NFS server while the clients are still running, you may be left with "dangling" shares; in this case, the command sudo umount -lf ... seems to help:

ubuntu@Client:~$ mount
...
Server-eth0:/export/sharetest on /tmp/nfsshare type nfs (rw,addr=192.168.1.42)
Server-eth0:/export/sharetest on /tmp/.webmin/402201_1_save_mount.cgi type nfs (rw,vers=4,addr=192.168.1.42,clientaddr=192.168.1.77)
rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw)
Server-eth0:/export/sharetest on /tmp/.webmin/303774_1_save_mount.cgi type nfs (rw,vers=4,addr=192.168.1.42,clientaddr=192.168.1.77)

ubuntu@Client:~$ sudo umount -lf /tmp/.webmin/402201_1_save_mount.cgi
ubuntu@Client:~$ sudo umount -lf /tmp/.webmin/303774_1_save_mount.cgi

ubuntu@Client:~$ mount
...
Server-eth0:/export/sharetest on /tmp/nfsshare type nfs (rw,addr=192.168.1.42)

webmin install on Server (Ubuntu 11.04 proper install)

suser@Server:tmp$ sudo apt-get install nfs-kernel-server  # also pulls nfs-common
suser@Server:tmp$ sudo apt-get install libauthen-pam-perl libio-pty-perl libnet-ssleay-perl
suser@Server:tmp$ wget http://prdownloads.sourceforge.net/webadmin/webmin_1.580_all.deb
suser@Server:tmp$ sudo dpkg -i webmin_1.580_all.deb

Stop services

sudo service nfs-kernel-server stop   # also clears /etc/exports
sudo service idmapd stop
sudo service portmap stop
sudo service webmin stop    # also: sudo /etc/webmin/stop

Uninstall

sudo apt-get remove --purge nfs-kernel-server libauthen-pam-perl libio-pty-perl libnet-ssleay-perl && sudo apt-get autoremove --purge
# sudo dpkg -r webmin # not needed; the previous command should remove webmin by dependency

webmin install on Client (Ubuntu 12.04 live image)

ubuntu@Client:~$ sudo nano /ets/apt/sources.list  # uncomment `universe` repositories, and save
ubuntu@Client:~$ sudo apt-get update
ubuntu@Client:~$ sudo apt-get install nfs-common  # "initctl: Unknown job: portmap / statd / gssd / idmapd" here
ubuntu@Client:~$ sudo initctl reload-configuration
ubuntu@Client:~$ sudo apt-get install --reinstall rpcbind nfs-common # now "portmap ... idmapd start/running,"
ubuntu@Client:~$ sudo apt-get install libauthen-pam-perl libio-pty-perl libnet-ssleay-perl
ubuntu@Client:~$ wget http://prdownloads.sourceforge.net/webadmin/webmin_1.580_all.deb
ubuntu@Client:~$ sudo dpkg -i webmin_1.580_all.deb

Stop services

sudo service idmapd stop
sudo service portmap stop
sudo service webmin stop    # also: sudo /etc/webmin/stop

Uninstall

sudo apt-get remove --purge nfs-common libauthen-pam-perl libio-pty-perl libnet-ssleay-perl && sudo apt-get autoremove --purge
# sudo dpkg -r webmin # not needed; the previous command should remove webmin by dependency

Installation notes:

  • webmin is not available in Ubuntu repositories; it can be installed through a .deb package from the webmin site
    • downloading an older .deb like here is not a problem, because webmin allows for updates directly from its web interface
  • Nearly all webmin dependencies are available in the Ubuntu main repositories, except for libauthen-pam-perl, which is in the universe repositories
  • Ubuntu live images have the universe repositories disabled by default; so they must first be enabled by uncommenting the respective entries in /etc/apt/sources.list, followed by sudo apt-get update (else E: Unable to locate package libauthen-pam-perl / E: Package 'libauthen-pam-perl' has no installation candidate occurs)
  • Ubuntu live images apparently "did not rescan the /etc/init directory automatically" (ref. [1]), so they need a manual call to initctl reload-configuration (else initctl: Unknown job: portmap occurs)
    • initclt needs to be called with sudo (else initctl: Rejected send message, 1 matched rules; ... occurs)
  • After installing nfs-common, a service called portmap exists on both 11.04 and 12.04,
    • ... however, 11.04 has a package called portmap - while 12.04 replaces it with a package rpcbind (message Note, selecting 'rpcbind' instead of 'portmap' occurs)
    • What used to be known as nfs-common service in older Ubuntus, is now (apparently) called idmapd (ref. [2])
  • There is no nfs service (may be found in older tutorials) installed anywhere - neither on server nor on client
  • libio-pty-perl may already be present on your system, if you have installed e.g. moreutils; if so, be careful not to refer to it in the above uninstall commands (same goes for other dependencies)

References:

  1. Bug #857406 “Failed to install rpcbind” (#3) : Bugs : “linux” package : Ubuntu
  2. How to restart (or stop or heck even start) the nfs client service on ubuntu 9.10? - Super User
  3. [SOLVED] write permission for users on NFS folder
  4. Ubuntu Server: NFS Client and Server configuration using Webmin
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.