Mount network shares
Chances are you have many files and folders that exist on other computers on your network. As long as we have these resources set up as Shared folders in Windows or by using NFS or a Samba server in Linux, we can connect and mount these network filesystems as long as we know the credentials. First we need to create a folder we can use as a mount point. To do this, simply open a terminal. In this example, we are going to mount a resource called gr0x0rd from the computer teletran4.
$ mkdir teletran4
This will create a folder called teletran4 in our home directory which we can use as our mount point. Now, let's mount the network folder.
The following example will allow you to mount a share from Microsoft Windows or a Linux Samba server. Substitute the correct path, resource name and credentials below with your own settings.
$ sudo mount -t cifs //teletran4/gr0x0rd /home/username/teletran4 -o username=username,password=password
To make our life easier down the road, let's create a script that will perform this task for us when we call a simple command. Simply replace teletran4 with the name of your network resource.
$ sudo nano -w /usr/bin/teletran4
Make the contents of the file the same as the command you used above to successfully connect without the sudo prefix.
#!/bin/bash mount -t cifs //teletran4/gr0x0rd /home/username/teletran4 -o username=username,password=password
Once you are satisfied, save the file and exit nano. Next we'll want to set the permissions on the file so normal users have permission to run it, and set it as executable. Substitute teletran4 with the name of your file in the example below.
$ sudo chown root:users /usr/bin/teletran4 $ sudo chmod 755 /usr/bin/teletran4
You can now call this script whenever you want to connect to your network resource. Since we created the script in the folder /usr/bin, which is part of the system path, you can call it from any location on that computer. You'll need to prefix the command with sudo since it contains the mount command, which can only be performed by root. Substitute teletran4 with the name of your file in the example below.
$ sudo teletran4
You should now be able to browse the network resource by navigating to the folder you created as the mount point.
If you are mounting an nfs share from another linux system, the mount command is quite similar. Substitute the correct server ip, path and resource name with your own.
$ mount -t nfs -o nolock serverip:/home/gr0x0rd /home/gr0x0rd/teletran4
Remember, with nfs shares, permissions to connect are configured via the /etc/exports file on the server, so you don't need to pass the credentials as you would connecting to a Windows or Samba share. Let's now go on to Customizing your Desktop.