To mount a remote SFTP (SSH File Transfer Protocol) directory to a local Ubuntu system, you can use the sshfs
command. This allows you to access and interact with the remote files as if they were local. Here are the steps:
1. Install sshfs
:
Ensure that sshfs
is installed on your local Ubuntu system. You can install it using the following command:
sudo apt-get update
sudo apt-get install sshfs
2. Create a Mount Point:
Choose or create a local directory where you want to mount the remote SFTP file system. For example, you can create a directory named “remote_mount” in your home directory:
mkdir ~/remote_mount
3. Mount the Remote SFTP Directory:
Use the sshfs
command to mount the remote directory. Replace <username>
, <hostname>
, and <remote_directory>
with your SFTP credentials and the path to the remote directory:
sshfs <username>@<hostname>:/path/to/remote/directory ~/remote_mount
Example:
sshfs john@example.com:/home/john/data ~/remote_mount
4. Access the Mounted Directory:
After running the sshfs
command, you can access the remote files in the local remote_mount
directory. The files in this directory are essentially the files on the remote SFTP server.
5. Unmount the Remote Directory:
When you’re done, you can unmount the remote directory using the following command:
fusermount -u ~/remote_mount
This will unmount the remote SFTP directory, and you can remove the local mount point if you no longer need it.
Keep in mind that sshfs
requires SSH access to the remote server, and you should have proper authentication configured (password or key-based authentication). Additionally, ensure that the SSH server on the remote system allows SFTP access.