{"id":878,"date":"2018-04-16T08:17:51","date_gmt":"2018-04-16T08:17:51","guid":{"rendered":"http:\/\/jaipurhosting.com\/blog\/?p=878"},"modified":"2019-04-29T15:20:40","modified_gmt":"2019-04-29T09:50:40","slug":"how-to-mount-remote-partition-via-ssh-on-centos","status":"publish","type":"post","link":"https:\/\/www.jaipurhosting.com\/blog\/how-to-mount-remote-partition-via-ssh-on-centos\/","title":{"rendered":"How to Mount Remote Partition via SSH on CentOS"},"content":{"rendered":"<p><strong>Description about SSHFS&nbsp;<\/strong><\/p>\n<p>SSHFS (<strong>SSH Filesystem<\/strong>) is a filesystem client to mount and interact with directories and files located on a remote server or workstation over a normal ssh connection.<\/p>\n<p>The client interacts with the remote file system via the SSH File Transfer Protocol (<strong>SFTP<\/strong>), a network protocol providing file access, file transfer, and file management functionality over any reliable data stream that was designed as an extension of the <strong>Secure Shell protocol<\/strong> (SSH) version 2.0.<\/p>\n<p>SFTP provides secure file transfer and a secure remote file system.<\/p>\n<p>While SFTP clients may transfer files and directories, the related file system may not be mounted locally using SFTP alone<\/p>\n<p>Using SSHFS, a remote file system may be treated in the same way as other volumes (such as CDs, DVDs, USB flash drives and shared disks).<\/p>\n<p>We can easily mount a remote file system by using SSHFS.<\/p>\n<p>&nbsp;<\/p>\n<p>Step 1. <strong>Enable the EPEL repo<\/strong><\/p>\n<p>We will need to install a few packages that are not available in the standard CentOS repository.<\/p>\n<p>In order to do this we must enable the EPEL repo, click on <a href=\"http:\/\/jaipurhosting.com\/blog\/how-to-enable-epel-repository-in-centos-7\/\">Link<\/a> to know about enable the EPEL repo.<\/p>\n<p>&nbsp;<\/p>\n<p>Step 2. <strong>Install FUSE and SSHFS packages<\/strong><\/p>\n<p>SSHFS uses FUSE (<strong>Filesystem<\/strong> in Userspace). Install the required packages<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# yum install fuse sshfs<\/pre>\n<p>&nbsp;<\/p>\n<p>Step 3. <strong>Load the FUSE module<\/strong><\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# modprobe fuse<\/pre>\n<p>&nbsp;<\/p>\n<p>Confirm that the FUSE module is loaded :<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# lsmod | grep fuse\nfuse&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;84368&nbsp; &nbsp; &nbsp; 2<\/pre>\n<p>&nbsp;<\/p>\n<p>Make sure the FUSE module is loaded upon a reboot :<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# echo \"modprobe fuse\" &gt;&gt; \/etc\/rc.local<\/pre>\n<p>&nbsp;<\/p>\n<p>Step 4. <strong>Using SSHFS<\/strong><\/p>\n<p>Once the <strong>FUSE module<\/strong> is loaded, we can finally mount our remote partition using SSHFS :<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# sshfs user@remote_host:\/remote_directory \/local_mount_partition<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# sshfs root@1.2.3.4:\/scripts \/mnt<\/pre>\n<p>&nbsp;<\/p>\n<p>Note: SSHFS is not recommended for production, distributed file-systems.<\/p>\n<p>NFS is a better option, however, SSHFS can still be quite useful.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description about SSHFS&nbsp; SSHFS (SSH Filesystem) is a filesystem client to mount and interact with directories and files located on a remote server or workstation over a normal ssh connection. The client interacts with the remote file system via the SSH File Transfer Protocol (SFTP), a network protocol providing file access, file transfer, and file [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1308,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-878","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/878","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/comments?post=878"}],"version-history":[{"count":2,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/878\/revisions"}],"predecessor-version":[{"id":1557,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/878\/revisions\/1557"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/media\/1308"}],"wp:attachment":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/media?parent=878"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/categories?post=878"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/tags?post=878"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}