Cloud Storage: SSH Mount How to

Installing fuse-sshfs

 

Debian/Ubuntu

apt-get install sshfs

CentOS

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6-8.noarch.rpm
yum install fuse-sshfs

 

Setup sshmount

  

Create the mountpoint directory:

mkdir /mnt/sshfs_mount

Connect and mount with sshfs:

sshfs user@hostname:/ /mnt/sshfs_mount/

If the Cloud Storage panel informs you to connect to cloudstorage3.hivelocity.net or cloudstorage4.hivelocity.net, use the full path to your remote home directory:

sshfs user@hostname:/home/user/ /mnt/sshfs_mount/

You may now write to your newly mounted storage in /mnt/sshfs_mount/.

 

Using rsync

 

Synchronizing a local directory with a remote one:

rsync -r -a -v --delete /home /mnt/sshfs_mount

CentOS Example:

[root@centos6 ~]# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
    --2014-01-22 07:10:58--  http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
    Resolving dl.fedoraproject.org... 209.132.181.25, 209.132.181.26, 209.132.181.27, ...
    Connecting to dl.fedoraproject.org|209.132.181.25|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 14540 (14K) [application/x-rpm]
    Saving to: âepel-release-6-8.noarch.rpmâ
    100%[======================================>] 14,540      --.-K/s   in 0.04s
    2014-01-22 07:10:58 (331 KB/s) - âepel-release-6-8.noarch.rpmâ

    [root@centos6 ~]# rpm -Uvh epel-release-6-8.noarch.rpm
    warning: epel-release-6-8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 060                                            8b895: NOKEY
    Preparing...                ########################################### [100%]
       1:epel-release           ########################################### [100%]

    [root@centos6 ~]# yum install fuse-sshfs
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    epel/metalink                                            |  14 kB     00:00
     * base: ftp.usf.edu
     * epel: mirror.cogentco.com
     * extras: mirror.oss.ou.edu
     * updates: mirror.oss.ou.edu
    epel                                                     | 4.2 kB     00:00
    epel/primary_db                                          | 5.8 MB     00:00
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package fuse-sshfs.x86_64 0:2.4-1.el6 will be installed
    --> Processing Dependency: fuse >= 2.2 for package: fuse-sshfs-2.4-1.el6.x86_64
    --> Processing Dependency: openssh-clients for package: fuse-sshfs-2.4-1.el6.x86_64
    --> Processing Dependency: libfuse.so.2(FUSE_2.7)(64bit) for package: fuse-sshfs-2.4-1.el6.x86_64
    --> Processing Dependency: libfuse.so.2(FUSE_2.6)(64bit) for package: fuse-sshfs-2.4-1.el6.x86_64
    --> Processing Dependency: libfuse.so.2(FUSE_2.5)(64bit) for package: fuse-sshfs-2.4-1.el6.x86_64
    --> Processing Dependency: libfuse.so.2(FUSE_2.4)(64bit) for package: fuse-sshfs-2.4-1.el6.x86_64
    --> Processing Dependency: libfuse.so.2(FUSE_2.2)(64bit) for package: fuse-sshfs-2.4-1.el6.x86_64
    --> Processing Dependency: libfuse.so.2()(64bit) for package: fuse-sshfs-2.4-1.el6.x86_64
    --> Running transaction check
    ---> Package fuse.x86_64 0:2.8.3-4.el6 will be installed
    ---> Package fuse-libs.x86_64 0:2.8.3-4.el6 will be installed
    ---> Package openssh-clients.x86_64 0:5.3p1-94.el6 will be installed
    --> Processing Dependency: openssh = 5.3p1-94.el6 for package: openssh-clients-5.3p1-94.el6.x86_64
    --> Processing Dependency: libcrypto.so.10(libcrypto.so.10)(64bit) for package: openssh-clients-5.3p1-94.el6.x86_64
    --> Processing Dependency: libcrypto.so.10(OPENSSL_1.0.1)(64bit) for package: openssh-clients-5.3p1-94.el6.x86_64
    --> Processing Dependency: libedit.so.0()(64bit) for package: openssh-clients-5.3p1-94.el6.x86_64
    --> Running transaction check
    ---> Package libedit.x86_64 0:2.11-4.20080712cvs.1.el6 will be installed
    ---> Package openssh.x86_64 0:5.3p1-84.1.el6 will be updated
    --> Processing Dependency: openssh = 5.3p1-84.1.el6 for package: openssh-server-5.3p1-84.1.el6.x86_64
    ---> Package openssh.x86_64 0:5.3p1-94.el6 will be an update
    ---> Package openssl.x86_64 0:1.0.0-27.el6 will be updated
    ---> Package openssl.x86_64 0:1.0.1e-16.el6_5.4 will be an update
    --> Processing Dependency: make for package: openssl-1.0.1e-16.el6_5.4.x86_64
    --> Running transaction check
    ---> Package make.x86_64 1:3.81-20.el6 will be installed
    ---> Package openssh-server.x86_64 0:5.3p1-84.1.el6 will be updated
    ---> Package openssh-server.x86_64 0:5.3p1-94.el6 will be an update
    --> Finished Dependency Resolution
    Dependencies Resolved
    ================================================================================
     Package             Arch       Version                       Repository   Size
    ================================================================================
    Installing:
     fuse-sshfs          x86_64     2.4-1.el6                     epel         52 k
    Installing for dependencies:
     fuse                x86_64     2.8.3-4.el6                   base         71 k
     fuse-libs           x86_64     2.8.3-4.el6                   base         74 k
     libedit             x86_64     2.11-4.20080712cvs.1.el6      base         74 k
     make                x86_64     1:3.81-20.el6                 base        389 k
     openssh-clients     x86_64     5.3p1-94.el6                  base        402 k
    Updating for dependencies:
     openssh             x86_64     5.3p1-94.el6                  base        258 k
     openssh-server      x86_64     5.3p1-94.el6                  base        311 k
     openssl             x86_64     1.0.1e-16.el6_5.4             updates     1.5 M

    Transaction Summary
    ================================================================================
    Install       6 Package(s)
    Upgrade       3 Package(s)

    Total download size: 3.1 M
    Is this ok [y/N]: y
    Downloading Packages:
    (1/9): fuse-2.8.3-4.el6.x86_64.rpm                       |  71 kB     00:00
    (2/9): fuse-libs-2.8.3-4.el6.x86_64.rpm                  |  74 kB     00:00
    (3/9): fuse-sshfs-2.4-1.el6.x86_64.rpm                   |  52 kB     00:00
    (4/9): libedit-2.11-4.20080712cvs.1.el6.x86_64.rpm       |  74 kB     00:00
    (5/9): make-3.81-20.el6.x86_64.rpm                       | 389 kB     00:00
    (6/9): openssh-5.3p1-94.el6.x86_64.rpm                   | 258 kB     00:00
    (7/9): openssh-clients-5.3p1-94.el6.x86_64.rpm           | 402 kB     00:00
    (8/9): openssh-server-5.3p1-94.el6.x86_64.rpm            | 311 kB     00:00
    (9/9): openssl-1.0.1e-16.el6_5.4.x86_64.rpm              | 1.5 MB     00:00
    --------------------------------------------------------------------------------
    Total                                           2.5 MB/s | 3.1 MB     00:01
    warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895: Userid : EPEL (6)
Package: epel-release-6-8.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : 1:make-3.81-20.el6.x86_64 1/12
Updating : openssl-1.0.1e-16.el6_5.4.x86_64 2/12
Updating : openssh-5.3p1-94.el6.x86_64 3/12
Installing : fuse-libs-2.8.3-4.el6.x86_64 4/12
Installing : fuse-2.8.3-4.el6.x86_64 5/12
Installing : libedit-2.11-4.20080712cvs.1.el6.x86_64 6/12
Installing : openssh-clients-5.3p1-94.el6.x86_64 7/12
Installing : fuse-sshfs-2.4-1.el6.x86_64 8/12
Updating : openssh-server-5.3p1-94.el6.x86_64 9/12
Cleanup : openssh-server-5.3p1-84.1.el6.x86_64 10/12
Cleanup : openssh-5.3p1-84.1.el6.x86_64 11/12
Cleanup : openssl-1.0.0-27.el6.x86_64 12/12
Verifying : libedit-2.11-4.20080712cvs.1.el6.x86_64 1/12
Verifying : openssl-1.0.1e-16.el6_5.4.x86_64 2/12
Verifying : fuse-2.8.3-4.el6.x86_64 3/12
Verifying : openssh-5.3p1-94.el6.x86_64 4/12
Verifying : openssh-server-5.3p1-94.el6.x86_64 5/12
Verifying : fuse-sshfs-2.4-1.el6.x86_64 6/12
Verifying : openssh-clients-5.3p1-94.el6.x86_64 7/12
Verifying : fuse-libs-2.8.3-4.el6.x86_64 8/12
Verifying : 1:make-3.81-20.el6.x86_64 9/12
Verifying : openssh-server-5.3p1-84.1.el6.x86_64 10/12
Verifying : openssh-5.3p1-84.1.el6.x86_64 11/12
Verifying : openssl-1.0.0-27.el6.x86_64 12/12
Installed:
fuse-sshfs.x86_64 0:2.4-1.el6
Dependency Installed:
fuse.x86_64 0:2.8.3-4.el6      fuse-libs.x86_64 0:2.8.3-4.el6             libedit.x86_64 0:2.11-4.20080712cvs.1.el6
make.x86_64 1:3.81-20.el6 openssh-clients.x86_64 0:5.3p1-94.el6
Dependency Updated:
openssh.x86_64 0:5.3p1-94.el6 openssh-server.x86_64 0:5.3p1-94.el6 openssl.x86_64 0:1.0.1e-16.el6_5.4
Complete!

[root@centos6 ~]# mkdir /cloudstorage
[root@centos6 ~]# sshfs caccount_1077@cloudstorage2.hivelocity.net:/ /cloudstorage/
The authenticity of host 'cloudstorage2.hivelocity.net (206.51.235.186)' can't be established.
RSA key fingerprint is 52:ba:48:2b:31:d9:c1:ea:ea:ea:c0:a2:22:db:a5:98.
Are you sure you want to continue connecting (yes/no)? yes
caccount_1077@cloudstorage2.hivelocity.net's password:

[root@centos6 ~]# mount
/dev/mapper/vg_centos6-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620) .
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/vda1 on /boot type ext4 (rw)
/dev/mapper/vg_centos6-lv_home on /home type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
caccount_1077@cloudstorage2.hivelocity.net:/ on /cloudstorage type fuse.sshfs (rw,nosuid,nodev)

[root@centos6 ~]# cd /cloudstorage/

[root@centos6 cloudstorage]# mkdir test
[root@centos6 cloudstorage]# ls -la
total 316 drwx------. 1 502 502 189 Jan 22 2014 .
dr-xr-xr-x. 23 root root 4096 Jan 22 07:14 ..
-rw-r--r--. 1 root root 107513 Sep 11 15:47 apf-current.tar.gz
-rwxr-xr-x. 1 root root 11264 Sep 11 15:45 aquota.group
-rw-r--r--. 1 502 502 18 Jul 18 2013 .bash_logout
-rw-r--r--. 1 502 502 176 Jul 18 2013 .bash_profile
-rw-r--r--. 1 502 502 124 Jul 18 2013 .bashrc
-rw-r--r--. 1 root root 12232 Sep 11 15:47 epel-release-5-4.noarch.rpm
-rw-r--r--. 1 root root 160381 Sep 11 15:47 iftop-0.17.tar.gz
drwxr-xr-x. 1 502 502 12 Jan 22 2014 test

Ubuntu 12.0.4.3 Example:

root@logger:~# apt-get install sshfs
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following NEW packages will be installed:
      sshfs
    0 upgraded, 1 newly installed, 0 to remove and 22 not upgraded.
    Need to get 43.9 kB of archives.
    After this operation, 129 kB of additional disk space will be used.
    Get:1 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main sshfs amd64 2.3-1ubuntu0.1 [43.9 kB]
    Fetched 43.9 kB in 0s (207 kB/s)
    Selecting previously unselected package sshfs.
    (Reading database ... 139788 files and directories currently installed.)
    Unpacking sshfs (from .../sshfs_2.3-1ubuntu0.1_amd64.deb) ...
    Processing triggers for man-db ...
    Setting up sshfs (2.3-1ubuntu0.1) ...

    root@logger:~# mkdir /cloudstorage

    root@logger:~# sshfs caccount_1077@cloudstorage2.hivelocity.net:/ /cloudstorage/
    The authenticity of host 'cloudstorage2.hivelocity.net (206.51.235.186)' can't be established.
    RSA key fingerprint is 52:ba:48:2b:31:d9:c1:ea:f9:ac:c0:a2:22:db:a5:98.
    Are you sure you want to continue connecting (yes/no)? yes
    caccount_1077@cloudstorage2.hivelocity.net's password:

    root@logger:~# mount
    /dev/mapper/logger-root on / type ext4 (rw,errors=remount-ro)
    proc on /proc type proc (rw,noexec,nosuid,nodev)
    sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
    none on /sys/fs/fuse/connections type fusectl (rw)
    none on /sys/kernel/debug type debugfs (rw)
    none on /sys/kernel/security type securityfs (rw)
    udev on /dev type devtmpfs (rw,mode=0755)
    devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
    tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
    none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
    none on /run/shm type tmpfs (rw,nosuid,nodev)
    /dev/vda1 on /boot type ext2 (rw)
    caccount_1077@cloudstorage2.hivelocity.net:/ on /cloudstorage type fuse.sshfs (rw,nosuid,nodev,max_read=65536)