特殊:Badtitle/NS100:SSHFS
![]() |
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/SSHFS }} |
![]() |
点击翻译: |
English {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/af | • {{#if: php5|Afrikaans| [[::SSHFS/af|Afrikaans]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/ar | • {{#if: php5|العربية| [[::SSHFS/ar|العربية]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/az | • {{#if: php5|azərbaycanca| [[::SSHFS/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/bcc | • {{#if: php5|جهلسری بلوچی| [[::SSHFS/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/bg | • {{#if: php5|български| [[::SSHFS/bg|български]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/br | • {{#if: php5|brezhoneg| [[::SSHFS/br|brezhoneg]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/ca | • {{#if: php5|català| [[::SSHFS/ca|català]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/cs | • {{#if: php5|čeština| [[::SSHFS/cs|čeština]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/de | • {{#if: php5|Deutsch| [[::SSHFS/de|Deutsch]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/el | • {{#if: php5|Ελληνικά| [[::SSHFS/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/es | • {{#if: php5|español| [[::SSHFS/es|español]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/fa | • {{#if: php5|فارسی| [[::SSHFS/fa|فارسی]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/fi | • {{#if: php5|suomi| [[::SSHFS/fi|suomi]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/fr | • {{#if: php5|français| [[::SSHFS/fr|français]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/gu | • {{#if: php5|ગુજરાતી| [[::SSHFS/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/he | • {{#if: php5|עברית| [[::SSHFS/he|עברית]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/hu | • {{#if: php5|magyar| [[::SSHFS/hu|magyar]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/id | • {{#if: php5|Bahasa Indonesia| [[::SSHFS/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/it | • {{#if: php5|italiano| [[::SSHFS/it|italiano]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/ja | • {{#if: php5|日本語| [[::SSHFS/ja|日本語]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/ko | • {{#if: php5|한국어| [[::SSHFS/ko|한국어]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/ksh | • {{#if: php5|Ripoarisch| [[::SSHFS/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/mr | • {{#if: php5|मराठी| [[::SSHFS/mr|मराठी]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/ms | • {{#if: php5|Bahasa Melayu| [[::SSHFS/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/nl | • {{#if: php5|Nederlands| [[::SSHFS/nl|Nederlands]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/no | • {{#if: php5|norsk| [[::SSHFS/no|norsk]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/oc | • {{#if: php5|occitan| [[::SSHFS/oc|occitan]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/pl | • {{#if: php5|polski| [[::SSHFS/pl|polski]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/pt | • {{#if: php5|português| [[::SSHFS/pt|português]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/ro | • {{#if: php5|română| [[::SSHFS/ro|română]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/ru | • {{#if: php5|русский| [[::SSHFS/ru|русский]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/si | • {{#if: php5|සිංහල| [[::SSHFS/si|සිංහල]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/sq | • {{#if: php5|shqip| [[::SSHFS/sq|shqip]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/sr | • {{#if: php5|српски / srpski| [[::SSHFS/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/sv | • {{#if: php5|svenska| [[::SSHFS/sv|svenska]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/th | • {{#if: php5|ไทย| [[::SSHFS/th|ไทย]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/tr | • {{#if: php5|Türkçe| [[::SSHFS/tr|Türkçe]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/vi | • {{#if: php5|Tiếng Việt| [[::SSHFS/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/yue | • {{#if: php5|粵語| [[::SSHFS/yue|粵語]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/zh | • {{#if: php5|中文| [[::SSHFS/zh|中文]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/zh-hans | • {{#if: php5|中文(简体)| [[::SSHFS/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}SSHFS}}/zh-hant | • {{#if: php5|中文(繁體)| [[::SSHFS/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:php5|:SSHFS|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :SSHFS/zh | | {{#ifexist: SSHFS/zh | | {{#ifeq: {{#titleparts:SSHFS|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:SSHFS|1|-1|}} | zh | | }}
Overview
Ssh is a secure protocol for communicating between machines. Sshfs is a tool that uses ssh to enable mounting of a remote filesystem on a local machine; the network is (mostly) transparent to the user. Because ssh authenticates connections, you can be sure that only those who should have access to remote directories can mount them (as long as everything is configured properly). Because ssh encrypts connections, no one can see your files as they are transferred over the network.
Installation and Setup
Simply install the sshfs package. The dependencies should be automatically installed too.
sudo apt-get install sshfs Then add yourself to the fuse group. This is necessary so you can use thefusermount
command, which is needed by the FUSE userland filesystem utility. If you don't do this, you will get permission errors. You must log out and log back in in order for the changes to take effect.sudo adduser $USER fuseUsage
Now, assuming that you have an ssh server running on a remote machine, simply run the sshfs command to mount the remote directory. In this example, the remote directory is/projects
on remote hostfar
. The local mount point is ~/projects.sshfs $USER@far:/projects ~/projects To unmount,fusermount -u ~/projects To add it to your/etc/fstab
,sshfs#$USER@far:/projects /home/$USER/remote fuse defaults 0 0 Note that you have to change $USER to your login name when editingfstab
, but it is not necessary when typing commands (the shell does it for you in that case). One thing to be aware of is that your UID (User ID, the unique number of your user on a system) is not necessarily the same on the two hosts. When youls -l
, the user name associated with each file is printed in the third column. However, in the filesystem, only UIDs are stored, andls
simply looks up the UID and finds the user name associated with it. In Unix, UIDs are what matter, not the user names. So if you're 1000 on the local host and 1003 on the remote host, the sshfs mounted directory would show a different user name for your files. This is not a problem, though, because the ssh server on the remote machine is what is actually reading and writing files. So even though it shows up inls -l
as a different UID, any changes will be done through the ssh server on the remote host, which will use the correct UID for the remote machine. Problems may arise if you attempt to use a program that looks at UIDs of files (e.g.ls
prints the wrong user name).Links
* This page is based off of this howto.