This will be a small tutorial to show you how you can mount a website using the SSH protocol as a folder on your harddrive you can freely modify as if it were on your own computer.
The reasoning behind this is the transparent access to the files on another host, using your own window manager or programs that need to rely on them.
First you will need to install sshfs, this command is for Ubuntu:
sudo apt-get install sshfs
With that installed you can go ahead and create a mount folder, here we are not running in root so we will be mounting in a home folder, feel free to create it in /mnt/:
mkdir ~/mount/mysite.com
From there we will mount the folder:
sshfs -p 22 user@mysite.com:/srv/www/htdocs ~/mount/mysite.com
Notice how we can modify the port with the -p switch in case you have configured SSH to run on a separate port.
That is all. Try going to /home/username/mount/mysite.com" and you will notice it is mirrored to your website directory, you can freely modify the files directly with any program or method you wish.
Note: To unmount the folder, ensure you kill all processes that are using the mounted folder (lsof can be helpful), and run the command fusermount -u:
fusermount -u $HOME/mount/mysite.com
No comments:
Post a Comment