- Print Date:
- Nov 27, 2014 6:38:58 AM
Blog: SSH Auto-mount Network Share
(Beware - This blog/tutorial is directed towards linux based users)
When doing any type of work, especially web work, one of the royal pains is FTPing to your server, or any type of file transfer. Well now you can make it quick and painless. Let me introduce SSHFS. There are 3 major components when creating the SSHFS, and I will guide you through creating and installing all of the necessary steps. Now you can mount and use your file system to automatically upload files and folders to your server with ease.
The 3 Major components:
- SSH Automatic Login
- Install SSHFS
- Mount your folder(s)
SSH Automatic Login
Run this command (with the obvious variable substitutions). It should create a public ssh key on your server.
ssh-copy-id [-i [identity_file]] [user@]machine
- ssh-keygen -t dsa
- ssh-copy-id user@machiner.
Check to make sure it's there, the file should be called, "authorized_keys".
ls -al ~/.ssh/
If you're having trouble with this part, you can reference this tutorial which breaks this component into smaller steps: SSH Automatic Login [http://wp.uberdose.com/2006/10/16/ssh-automatic-login/].
sudo apt-get install sshfs
Or use whatever package manager your distribution provides.
Create a shell script, we'll call it "mount.sh", and add the contents:
sshfs [user]@[your_server].com:/dir/on/server /dir/to/mount
Run the script:
Go to the mounted directory and run the 'ls' command to make sure all of your files/folders from your server show up in your local directory.
After you have this successfully working you should at it to your startup scripts.
System >> Preferences >> Sessions >> [add_a_new_entry]
You should be all set. You should have an automatic SSH login (no prompt for a password) from your computer to your server and a mounted folder to your server that acts as an automatic FTP client. The files in your mounted directory should be synced with that of your server. Now all you have to do is move or copy your desired files/folders into the mounted directory, and voila, they're on your server.