最近習慣性訪問N個Linux機器,在不一樣機器間跳來跳去,非常麻煩,最終,找到了sshfs,能夠把遠程目錄直接映射到本地,無需修改遠程機器的設置,僅要求有ssh鏈接的權限(ssh都沒有的話,還能幹啥?!~!)html
官網地址: http://fuse.sourceforge.net/sshfs.htmlnode
安裝:ubuntu
#若是是ubuntu apt-get install sshfs #若是是Fedore yum install fuse-sshfs #若是是CentOS,貌似只能本身安裝了 wget http://nchc.dl.sourceforge.net/project/fuse/sshfs-fuse/2.4/sshfs-fuse-2.4.tar.gz tar xvf sshfs-fuse-2.4.tar.gz cd sshfs-fuse-2.4./configure #若是缺glib2什麼的,就自行裝上 make install
先看看選項:緩存
general options:-o opt,[opt...] mount options -h --help print help -V --version print version SSHFS options:-p PORT equivalent to '-o port=PORT'-C equivalent to '-o compression=yes'#啓用壓縮,建議配上-F ssh_configfile specifies alternative ssh configuration file #使用非默認的ssh配置文件-1 equivalent to '-o ssh_protocol=1'#不要用啊-o reconnect reconnect to server #自動重連-o delay_connect delay connection to server -o sshfs_sync synchronous writes -o no_readahead synchronous reads (no speculative readahead)#提早預讀-o sshfs_debug print some debugging information -o cache=BOOL enable caching {yes,no}(default: yes)#能緩存目錄結構之類的信息-o cache_timeout=N sets timeout for caches in seconds (default:20)-o cache_X_timeout=N sets timeout for{stat,dir,link} cache -o workaround=LIST colon separated list of workarounds none no workarounds enabled all all workarounds enabled [no]rename fix renaming to existing file (default: off)[no]nodelaysrv set nodelay tcp flag in sshd (default: off)[no]truncate fix truncate for old servers (default: off)[no]buflimit fix buffer fillup bug in server (default: on)-o idmap=TYPE user/group ID mapping, possible types are:#文件權限uid/gid映射關係 none no translation of the ID space (default) user only translate UID of connecting user -o ssh_command=CMD execute CMD instead of 'ssh'-o ssh_protocol=N ssh protocol to use(default:2)#確定要2的-o sftp_server=SERV path to sftp server or subsystem (default: sftp)-o directport=PORT directly connect to PORT bypassing ssh -o transform_symlinks transform absolute symlinks to relative -o follow_symlinks follow symlinks on the server -o no_check_root don't check for existence of 'dir' on server -o password_stdin read password from stdin (only for pam_mount) -o SSHOPT=VAL ssh options (see man ssh_config) Module options: [subdir] -o subdir=DIR prepend this directory to all paths (mandatory) -o [no]rellinks transform absolute symlinks to relative [iconv] #字符集轉換,對我這種UTF8控,默認已是最好的 -o from_code=CHARSET original encoding of file names (default: UTF-8) -o to_code=CHARSET new encoding of the file names (default: UTF-8)
實際使用:app
掛載(若是配上ssh key就能夠徹底自動化了): sshfs root@192.168.9.109:/opt /opt/s109 卸載: fusermount -u /opt/s109