最近习惯性访问N个Linux机器,在不同机器间跳来跳去,很是麻烦,最终,找到了sshfs,可以把远程目录直接映射到本地,无需修改远程机器的设置,仅要求有ssh连接的权限(ssh都没有的话,还能干啥?!~!)

官网地址: http://fuse.sourceforge.net/sshfs.html

安装:

#如果是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)

实际使用:

挂载(如果配上ssh key就可以完全自动化了):
sshfs root@192.168.9.109:/opt /opt/s109
卸载:
fusermount -u /opt/s109

 

简单好用的sshfs -- 通过ssh映射远程路径(转)的更多相关文章

  1. sshfs 通过ssh 挂载远程目录

    安装:yum -y install sshfs 挂载远程 ssh 文件系统: sshfs -p 1234 root@192.168.1.218:/home/ /mnt/ sshfs -p SSH端口 ...

  2. sshfs基于ssh挂载远程目录

    为了像本地一样访问远程主机上的目录,通常我们会在远程主机上使用nfs来导出目录,并在本地主机上mount这个nfs文件系统.如果是windows系统,则使用cifs或samba的方式来访问. 但可能我 ...

  3. Ubuntu SSH 客户端的应用 | sshfs映射远程文件系统为本地磁盘

    SSH是指Secure Shell,是一种安全的传输协议. Ubuntu客户端通过SSH访问远程服务器 ,以下步骤是客户端 的配置方法: 1. sudo apt-get install ssh 2. ...

  4. Linux使用sshfs通过ssh挂载远端机器

    Linux使用sshfs通过ssh挂载远端机器 今天自己的开发机器突然磁盘剩余空间报警,再弄一块硬盘不太现实,于是想到了公司有一台机器上挂了一个大的磁盘,于是,我把目标偷偷锁定到了那个机器上. 折腾了 ...

  5. Docker运行MongoDB及Redis及ssh端口映射远程连接

    Docker运行MongoDB及Redis及ssh端口映射远程连接 本节内容简介 在本实验里我们将通过完成 MongoDB 和 Redis 两个容器来学习Dockerfile及Docker的运行机制. ...

  6. 如何用ssh挂载远程目录

    如何用ssh挂载远程目录 标签: sshserver服务器linux网络 2011-06-24 10:05 2979人阅读 评论(0) 收藏 举报 版权声明:本文为博主原创文章,未经博主允许不得转载. ...

  7. 菜鸟学Linux命令:ssh命令 远程登录

    1.查看SSH客户端版本 有的时候需要确认一下SSH客户端及其相应的版本号.使用ssh -V命令可以得到版本号.需要注意的是,Linux一般自带的是OpenSSH: 下面的例子即表明该系统正在使用Op ...

  8. ubuntun安装ssh,并远程链接服务器操作

    SSH是一种以安全.加密方式连接远程主机或服务器的方法.SSH服务器接受从有SSH的客户机的连接,允许操作者象在本地一样地登录系统.你可以用SSH从远程运行shell和X程序. (1)安装SSH服务器 ...

  9. Tomcat映射虚拟路径到指定磁盘(eclipse)

    用WangEditor富文本编辑,上传图片的时候,本文主要记录一下Tomcat映射虚拟路径到指定磁盘,保存到指定路径中,且能实现页面预览. 在实现之前wangeditor的简单实用请参照博主小道仙的后 ...

随机推荐

  1. java中的继承Object

    一个类,要么是直接继承Object,要么就是间接继承Object,如下: class A{ } class B extends A{ } B 是A的子类,A是Object的子类,所以B间接继承了Obj ...

  2. JS-字符串操作,查找显示高亮

    <!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content=&q ...

  3. How to configure windows machine to allow file sharing with dns alias (CNAME)

    Source: http://serverfault.com/questions/23823/how-to-configure-windows-machine-to-allow-file-sharin ...

  4. android:shape

    android:shape=["rectangle" | "oval" | "line" | "ring"] shape ...

  5. 【整理】-- C++ 多线程

    os:ubuntu   c++ 1.创建线程 #include <iostream> #include <pthread.h> //多线程相关操作头文件,可移植众多平台 usi ...

  6. python chardet简单应用

    python的字符串编码识别模块(第三方库): 官方地址: http://pypi.python.org/pypi/chardet   import chardet import urllib   # ...

  7. SQLite数据库在本地可以写,发布到服务器就不能写

    用SQLite开发的一个Web Api,提供Json和Jsonp格式的数据,在本地使用vs2012开发并运行时,数据库的读写均正常. 但发布到Windows Server 2008 + IIS 7.5 ...

  8. 【Leetcode】【Hard】Insert Interval

    Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessa ...

  9. SQL关于日期的查询

    SQL查询某天的记录: datediff(day,[Datetime],'2012-08-03')=0 把Datetime换为你的相应字段: SQL查询今天的记录: datediff(day,[Dat ...

  10. Spring-Context之一:一个简单的例子

    很久之前就想系统的学习和掌握Spring框架,但是拖了很久都没有行动.现在趁着在外出差杂事不多,就花时间来由浅入深的研究下Spring框架.Spring框架这几年来已经发展成为一个巨无霸产品.从最初的 ...