Mount a SFTP connection to a folder in Ubuntu / Linux

To do this I used a program called SSHFS which has done a great job. First, install if from the repo

sudo apt-get install sshfs

You’ll need to create a directory to use as the location for your files

sudo mkdir /mnt/sshftps

Execute the command to connect the actual SFTP Server. Replace with the target IP address and use the -p option to specify the connection port. The user parameter is your user name. The :/ at the end of the IP address indicates the end of the IP address. Don’t try to put the port number after the colon

sudo sshfs -o allow_other -p 6789 /mnt/sshftps

This will create a semi-permanent connection which will close if the machine is restarted. You can create a permanent connection which will reopen when the machine starts by editing the fstab file in /etc/fstab. Add a command to the end and restart the machine. Personally, I haven’t tried this because it’s a potential security risk and I didn’t need 100% uptime. /mnt/sshftp

8 thoughts on “Mount a SFTP connection to a folder in Ubuntu / Linux

  1. hi tyvm for the post helped me to find a new solution to use. i do wish to add the auto mount command to fstab but my sftp server needs a password, would you please be so kind to put an example to auto map using fstab entry with a password (this is for home use and im aware of security risk) but i would like to use this.

  2. This isn’t mounting using SFTP?! It’s mounting using SSHFS! Both provide file access over SSH, but they are not the same thing…

Leave a Reply to Willie Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.