summaryrefslogtreecommitdiff
path: root/src/Remote_Mounting_File_Systems_Through_SSH.ascii
blob: 958a3771b3ba2000be974ce35780bd8372244134 (plain)
    1 Remote Mounting Filesystems Through SSH
    2 =======================================
    3 :author: Aaron Ball
    4 :email: nullspoon@iohq.net
    5 
    6 Today I was wanting to edit a few image files on a remote machine. Now, when I
    7 typically need to transfer files across the internet, I will transfer them
    8 through sftp. I prefer this method simply because I already have an ssh server
    9 running on my target machine, so I don't need to install anything extra (such
   10 as ftp or samba).
   11 
   12 In light of this, I figured that since you can transfer files through an ssh
   13 tunnel, you must be able to remotely mount a file system through ssh.
   14 
   15 Enter sshfs
   16 
   17 I searched around a bit and the first thing I found was sshfs (ssh file
   18 system). It allows you to remotely mount files systems through ssh/fuse (yay).
   19 <pre> apt-get install sshfs </pre> Before we get around to actually mounting
   20 the remote filesystem, we need to change permissions on one thing so we can use
   21 this as a non-root user since we don't run GUIs as root (at least I hope you
   22 all don't). Let's add execute permissions for all to the fusermount command.
   23 
   24 ----
   25 chmod +x /usr/bin/fusermount
   26 ----
   27 
   28 Now that we have done that, we can proceed with mounting. I create a
   29 mount location in my home directory for ease of access.
   30 
   31 ----
   32 mkdir ~/mount
   33 ----
   34 
   35 Now that we have a place to mount our remote location,
   36 let's actually perform the dastardly deed.
   37 
   38 ----
   39 sshfs <username>@<RemoteServer>:<RemotePath> <LocalMountPoint>
   40 ----
   41 
   42 A good example of this is
   43 
   44 ----
   45 sshfs jimneycricket@nowhereissomewhere:/home/jimneycricket ~/mount
   46 ----
   47 
   48 It will ask you for a password. Supply the password and all should be well.
   49 Open up your file manager and navigate to \~/mount and you should see the files
   50 on your remote server (in this case, the home directory for jimneycricket).
   51 
   52 To unmount, you need to log in as root/sudo and run umount \~/mount.
   53 
   54 Finally, if you change the ports that ssh listens to on all of your ssh
   55 servers, you need to add one extra bit to the sshfs string. To connect to a
   56 port other than the default 22, put 
   57 
   58 ----
   59 -p <port>
   60 ----
   61 
   62 just after sshfs and you'll be set.
   63 
   64 Yay for seamless mounting!
   65 
   66 Category:Linux
   67 
   68 
   69 // vim: set syntax=asciidoc:

Generated by cgit