How to automount network folders in linux

There will be situations where you will want to mount remote folders in your local machine.

If you're on a linux machine, you may already be using sshfs to mount a network folder to your local machine.

This is easily achieved by issuing the command:

$ sshfs <user@remote-machine:/remote/folder> <local-folder>

Doing this, you will be asked for your password each time you connect to the remote host. To avoid this, you can copy your public key to the remote machine to enable you to mount the remote folder in a script. You can follow the instructions from my previous article.

The command can be inserted into ~/.profile file.

After adding the command to ~/.profile, log off and log back in. The network mount should be visible on your desktop or in file manager.