Purpose: to mount a remote directory on my local Ubuntu Linux Desktop system using SFTP (which is SSH in an FTP-like fashion).
The goal is to easily gain access to a remote system’s files through another folder on my desktop. Debina/Ubuntu allows you to easily mount SSH folders via the GUI, however, these mounts won’t show up in the terminal (and in some programs).
sshfs to accomplish this.
Ubuntu’s SSHFS documentation here.
Sshfs and mount
- add your username to the
fuse
group.- On Ubuntu, you would open a terminal window and perform the following:
1 2 3 |
sudo aptitude update sudo aptitude install sshfs sudo adduser yourusername fuse |
- SFTP server. I created a folder on my desktop called
sftp
. - Once the folder has been created, simply run
sshfs
using the appropriate login information (host username and IP), the host and local directories, and the SFTP connection is mounted on a folder on my desktop.
1 2 |
mkdir ~/Desktop/sftp sshfs kutayzorlu@remote.host.or.ip:/host/dir/to/mount ~/Desktop/sftp |
possible errors and workarounds
1 2 3 4 5 6 |
sshfs HOSTuser@remote.host.or.ip:/host/dir/to/mount ~/Desktop/sftp #fusermount: failed to open /dev/fuse: No such file or directory Fix : sudo mknod -m 666 /dev/fuse c 10 229 |
Create a bash alias to save time and typing
-
1234567891011121314151617181920sure system reads from the~/.bash_aliases file .# Alias definitions.# ~/.bash_aliases,.# Check /usr/share/doc/bash-doc/examples in the bash-doc package.if [ -f ~/.bash_aliases ]; then. ~/.bash_aliasesfinano ~/.bash_aliasesalias dt-sftp='sudo mknod -m 666 /dev/fuse c 10 229;sshfs HOSTuser@remote.host.or.ip:/host/dir/to/mount ~/Desktop/sftp'dt-sftp. ~/.bash_aliases
unmount
1 |
fusermount -u ~/Desktop/sftp |