Menu Close

Setting up and Using NFS and SSH in Ubuntu Linux

This article talks about the commands and steps needed to set up and use NFS and SSH in Ubuntu Linux.

For more on this subject, please refer to the SOC Table of Contents.


Turning on NFS

We will need to use NFS when developing Linux drivers. Thus, we will first download and turn on NFS by using the following command to download it:

sudo apt-get install nfs-kernel server

After installation is complete, we will create a folder named “linux” in the user’s root directory, and then create another folder named “nfs” within that folder.

Note that the nfs folder that we created is for the NFS server to use. We can then be able to use the network file system on development boards to access the nfs folder.

First, we will go on to set up NFS. NFS allows for mounted directories and permissions to be defined in the file /etc/exports. We can use the following command to setup the /etc/exports file:

sudo vi /etc/exports

After we open up /etc/exports, we can append the following to the file:

/home/zynq/linux/nfs *(rw, sync, no_root_squash)

Note that /home/zynq/linux/nfs is the directory to be shared, while “*” allows for all of the network segments to be able to access it. rwrepresents the permission to both read and write, and sync is writing synchronous files to the storage. Finally, no_root_squash represents the permissions of the user of the client shared directory. If the client is using the root user, the shared directory client would then have root permissions.

After the addition, /etc/exports would look like the following:

Next, we will save the file and restart NFS by using the following command:

sudo service nfs-kernel-server restart

We will then execute the following command to show the shared directory:

showmount -e

We can thus see that it is the correct directory.

While NFS is running, the /etc/exports setup file is changed. We can use the exportfs command to apply the changes:

sudo exportfs -rv



Turning on SSH

We will first install SSH by using the following command:

sudo apt-get install openssh-server

Note that the configuration file for SSH is /etc/sshd_config. We can leave it as is without doing anything, and just use the default settings.

Posted in Textbook and Training Project

Related Articles

Leave a Reply

Your email address will not be published.

Leave the field below empty!