Map Remote Server Directories to Local Ubuntu Machine

At times we need to perform a number of actions on directories of remote server. For that either we use ssh or we do scp. Another good alternate is mapping the remote server directory to our local machine. Lets get started with

sudo apt-get install sshfs

Create a local folder to map with remote server

mkdir /path_to_local_folder/local_folder_name

Now get started with mounting the remote directory

echo password | sshfs user_name@remote_server_ip:/path_to_remote_folder/remote_folder_name /path_to_local_folder/local_folder_name -o workaround=rename -o password_stdin

This will mount the remote directory to our local machine. We can check if the directory has been mounted successfully.

mountpoint /path_to_local_folder/local_folder_name

It must return

/path_to_local_folder/local_folder_name is a mountpoint

To unmount the folder

fusermount -u /path_to_local_folder/local_folder_name

Now doing again mountpoint /path_to_local_folder/local_folder_name returns

/path_to_local_folder/local_folder_name is not a mountpoint.