{"id":576,"date":"2016-01-02T18:13:48","date_gmt":"2016-01-02T10:13:48","guid":{"rendered":"http:\/\/www.datarelab.com\/blog\/?p=576"},"modified":"2016-01-02T18:14:22","modified_gmt":"2016-01-02T10:14:22","slug":"sshfs-%e8%bf%9c%e7%a8%8b%e6%8c%82%e5%9c%a8%e6%96%87%e4%bb%b6%e7%b3%bb%e7%bb%9f","status":"publish","type":"post","link":"https:\/\/www.datarelab.com\/blog\/Technical_literature\/576.html","title":{"rendered":"sshfs \u8fdc\u7a0b\u6302\u8f7d\u6587\u4ef6\u7cfb\u7edf"},"content":{"rendered":"<p>SSH \u662f\u4e00\u4e2a\u5f3a\u5927\u4e14\u5b89\u5168\u7684\u5de5\u5177\uff0c\u6211\u4eec\u9664\u4e86\u53ef\u4ee5\u7528\u5b83\u6765\u8fdc\u7a0b\u7ba1\u7406\u4e3b\u673a\u5916\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u5b83\u5efa\u7acb SSH tunnel \u4f5c Proxy \u7528\uff0c\u8fdc\u7a0b\u4f20\u8f93\u6587\u4ef6\u7b49\u7b49\u3002\u800c\u8fd9\u91cc\u6211\u60f3\u8981\u4ecb\u7ecd\u53e6\u5916\u4e00\u4e2a\u529f\u80fd\uff0c\u90a3\u5c31\u662f\u7ed3\u5408 sshfs \u8fd9\u4e2a\u5de5\u5177\u53ef\u4ee5\u628a\u8fdc\u7a0b\u4e3b\u673a\u7684\u6587\u4ef6\u7cfb\u7edf\u6620\u5c04\u5230\u672c\u5730\u4e3b\u673a\u4e0a\uff0c\u900f\u8fc7 SSH \u628a\u8fdc\u7a0b\u6587\u4ef6\u7cfb\u7edf\u6302\u8f7d\u5230\u672c\u673a\u4e0a\uff0c\u8fd9\u6837\u6211\u4eec\u53ef\u4ee5\u4e0d\u5fc5\u4f7f\u7528 scp \u5de5\u5177\u5c31\u53ef\u4ee5\u505a\u5230\u76f4\u63a5\u590d\u5236\u53ca\u5220\u9664\u8fdc\u7a0b\u4e3b\u673a\u7684\u6587\u4ef6\u4e86\uff0c\u5c31\u50cf\u64cd\u4f5c\u672c\u5730\u78c1\u76d8\u4e00\u6837\u65b9\u4fbf\u3002<br \/>\nsshfs \u662f\u57fa\u4e8e FUSE \u6784\u5efa\u7684 SSH \u6587\u4ef6\u7cfb\u7edf\u5ba2\u6237\u7aef\u7a0b\u5e8f\uff0c\u901a\u8fc7\u5b83\u8fdc\u7a0b\u4e3b\u673a\u7684\u914d\u7f6e\u65e0\u9700\u4f5c\u4efb\u4f55\u6539\u53d8\uff0c\u5c31\u53ef\u4ee5\u900f\u8fc7 SSH \u534f\u8bae\u6765\u6302\u8f7d\u8fdc\u7a0b\u6587\u4ef6\u7cfb\u7edf\u4e86\uff0c\u975e\u5e38\u65b9\u4fbf\u53ca\u5b89\u5168\u3002<br \/>\n\u9996\u5148\u5b89\u88c5epel\u7684yum\u6e90\u65b9\u4fbf\u5b89\u88c5<br \/>\nrpm -Uvh http:\/\/download.fedora.redhat.com\/pub\/epel\/5\/i386\/epel-release-5-4.noarch.rpm<br \/>\nyum -y install sshfs<\/p>\n<p>\u6302\u8f7d\u8fdc\u7a0b ssh \u6587\u4ef6\u7cfb\u7edf\uff1a<\/p>\n<p>sshfs root@192.168.1.218:\/home\/ \/mnt\/<br \/>\nsshfs \u7528\u6237\u540d@\u8fdc\u7a0b\u4e3b\u673aIP:\u8fdc\u7a0b\u4e3b\u673a\u8def\u5f84 \u672c\u5730\u6302\u8f7d\u70b9<br \/>\nsshfs -o transform_symlinks -o follow_symlinks user@hostname: \/home\/username\/sshfs<br \/>\n-o transform_symlinks \u8868\u793a\u8f6c\u6362\u7edd\u5bf9\u94fe\u63a5\u7b26\u53f7\u4e3a\u76f8\u5bf9\u94fe\u63a5\u7b26\u53f7<br \/>\n-o follow_symlinks \u6cbf\u7528\u670d\u52a1\u5668\u4e0a\u7684\u94fe\u63a5\u7b26\u53f7<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u901a\u8fc7\/etc\/fstab \u5f00\u673a\u81ea\u52a8\u6302\u8f7d<\/strong><\/p>\n<p>I was able to make sshfs mount via fstab with Ubuntu 14.04 by doing using the following syntax as a standard user (note anything in CAPS is a variable for you to fill in):<\/p>\n<p><strong>USER@HOST:\/REMOTE_DIR \/LOCAL_DIR fuse.sshfs delay_connect,_netdev,user,idmap=user,transform_symlinks,identityfile=\/home\/USERNAME\/.ssh\/id_rsa,allow_other,default_permissions,uid=USER_ID,gid=USER_GID 0 0<\/strong><br \/>\nThis is a combination of the information found here http:\/\/superuser.com\/questions\/669287\/automount-sshfs-using-fstab-without-mount-a and adding the **delay_connect** from here http:\/\/askubuntu.com\/questions\/326977\/sshfs-is-not-mounting-automatically-at-boot-despite-etc-fstab-configuration.<\/p>\n<p>I used this tutorial to get my USER_ID and USER_GID: https:\/\/kb.iu.edu\/data\/adwf.html<\/p>\n<p>To find a user\u2019s UID or GID in Unix, use the id command. To find a specific user\u2019s UID, at the Unix prompt, enter:<\/p>\n<p><strong>id -u username<\/strong><\/p>\n<p>Replace username with the appropriate user\u2019s username. To find a user\u2019s GID, at the Unix prompt, enter:<\/p>\n<p><strong>id -g username<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>SSH \u662f\u4e00\u4e2a\u5f3a\u5927\u4e14\u5b89\u5168\u7684\u5de5\u5177\uff0c\u6211\u4eec\u9664\u4e86\u53ef\u4ee5\u7528\u5b83\u6765\u8fdc\u7a0b\u7ba1\u7406\u4e3b\u673a\u5916\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u5b83\u5efa\u7acb SSH tunnel \u4f5c  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-576","post","type-post","status-publish","format-standard","hentry","category-Technical_literature"],"views":1846,"_links":{"self":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts\/576","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/comments?post=576"}],"version-history":[{"count":0,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts\/576\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/media?parent=576"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/categories?post=576"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/tags?post=576"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}