Thursday, February 21, 2019

Mounting Remote SSH Filesystem

This is how to mount remote SSH (Secure Sockets Host) filesystem on your local directory (e.g., /home/clemrasul/remoteserv) on Linux.  Mounting remote directories in this way allows you to do server side programming with ease since source code can be edited using your favorite GUI text editor.  The text editor need not have the feature of being able to log on to an SSH server.  Here are the steps:

Step 1:  Install the sshfs software

On Ubuntu, this is done using the command apt-get.

# apt-get install sshfs


Step 2:  Place it in the Linux module and give permissions

# modprobe fuse
# adduser clemrasul fuse
# chown root:fuse /dev/fuse
# chmod +x /dev/fuse

This assumes a username of "clemrasul" that is added to the "fuse" group.


Step 3:  Create the directory where the remove SSH filesystem will be mounted

# cd /home/clemrasul
# mkdir ~/remoteserv

This assumes a remove directory name of "remoteserv".


Step 4:  Mount the remote SSH directory as follows:

# sshfs {fully qualified SSH username}:{default directory}  {local directory mount point}

Example:

# sshfs clemrasul@taocoven.com:/home/clemrasul/html ~/remoteserv

You will be prompted by the remote SSH server for password.  Once authenticated, the remote directory can be seen in the local directory as:

# cd /home/clemrasul/remoteserv/





No comments: