Connect an Ubuntu computer to a Network Server at Login
| Operating Systems - Ubuntu Linux |
When I login to my Ubuntu computer, I like it to automatically connect to, or mount to my server. Once this is set up, all of my data that is on the server is easily accessible. This works for an Ubuntu server that is using NFS,
If you aren't using DNS, then add the server's IP to the /etc/hosts file by opening the Terminal on the Ubuntu computer. Below is an example of a hosts file. You need to add the IP and name of your server similar to below, based on your network configuration. These are just an example. The line in bold is the server I added.
127.0.0.1 localhost
192.168.2.3 server
If you are using DNS on your network, then you already have a network name for your server.
The next thing to do is to download the packages needed for NFS by using the following command:
sudo apt-get install nfs-common portmap
Next create the mount point directory on the workstation:
sudo mkdir /mnt/serverdata then give user ownership of the folder:
sudo chown user /mnt/serverdata
Where user is your user name for logging in to your Ubuntu computer, as well as your server.
To test, mount the server:
sudo mount server:/datashare /mnt/serverdata
Where server is your server's IP address that was placed in the
/etc/hosts file, and datashare is the NFS share point that has already been setup on your server.
Then create a file on the server from the workstation: touch /mnt/serverdata/test.txt then log on to the server and see if the file has been created in the /datashare folder.
Next we want to automatically mount the server from the workstation on boot. To do this, edit the /etc/fstab file and add the following line at the end:
server:/datashare /mnt/serverdata nfs rw,sync 0 0
Next, we need to link the mount point on our Ubuntu computer to the server. To do this, use the following command:
sudo ln -s /mnt/serverdata /datashare
Time to test by rebooting the Ubuntu computer.
Now anytime we want to reference the server, it is simply /datashare.
-- Mike
This article was originally posted on www.mikestechblog.com Any reproduction on any other site is prohibited and a violation of copyright laws.

