最近习惯性访问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. Nginx虚拟目录支持PHP配置

    感谢作者:http://blog.csdn.net/fangaoxin/article/details/7030139 location ~ ^/test/.+\.php$ { alias /var/ ...

  2. freeCodeCamp:Find the Longest Word in a String

    找到提供的句子中最长的单词,并计算它的长度. 函数的返回值应该是一个数字. /* 先把字符串 str 转为数组 myarr 将数组myarr中的每个元素长度转换成一个新的数组newarr 将这个数组按 ...

  3. LeetCode OJ-- Remove Element

    https://oj.leetcode.com/problems/remove-element/ 简单处理 class Solution { public: int removeElement(int ...

  4. nodejs+express使用html和jade

    nodejs+express经常会看到使用jade视图引擎,但是有些人想要访问普通的html页面,这也是可以的: var express = require('express'); var port ...

  5. JS-怎么得到局部域中的数据

    1,使用全局变量 var str = '';function fn1(){    var a = '大鸡腿~';    str = a;} 2,使用一个局部函数 function fn2(){     ...

  6. java图形化编程

    转载 学习Java Swing图形化编程,我们首先要了解三个最基本的概念:顶层容器,控件,布局. 下面就来介绍一下这三个基本概念 1.顶层容器 什么是顶层容器?当我们使用Java进行图形编程的时候,图 ...

  7. Windows7上搭建Cocos2d-x 3.1.1开发环境

    前言 现在,越来越多的公司采用Cocos2d-x 3.0来开发游戏了,但是现在这样的文章并不多,所以打算写一系列来帮助初学者快速掌握Cocos2d-x 3.0.首先就从开发环境的大家说起吧. 开发工具 ...

  8. ArcServer JS API开发离线部署方法

      1. 下载ArcGIS API for JavaScript 3.6 Library. (地址:http://support.esrichina.com.cn/uploadfile/Javascr ...

  9. 《The Book of CSS3》学习笔记

    一.浏览器前缀 E{ -moz-name : value; /* Firefox */ -ms-name : value; /* IE */ -o-name : value; /* Opera */ ...

  10. 在Android中进行单元测试遇到的问题

    问题1.Cannot connect to VM  socket closed 在使用JUnit进行测试的时候,遇到这个问题.网上的解释是:使用Eclipse对Java代码进行调试,无论是远程JVM还 ...