sshfs远程挂载
#常用命令
sshfs -o nonempty,reconnect,allow_other,exec -p22 zjy@172.21.0.10:/data/zjy /data/zjy cat /etc/fstab
sshfs#zjy@172.21.0.10:/data/zjy /data/zjy fuse nonempty,reconnect,allow_other,exec 0 0
一、什么是 SSHFS
SSHFS(Secure SHell FileSystem)是一个客户端,可以让我们通过 SSH 文件传输协议(SFTP)挂载远程的文件系统并且在本地机器上和远程的目录和文件进行交互。
centos:
yum install sshfs ubuntu:
sudo apt-get install sshfs
二、准备两台任意操作系统
一台
mkdir /test/zjy/ 另一台
mkdir /test/zjy/
三、挂载
sudo sshfs -o nonempty,allow_other,exec root@xx.xx.xx.xx:/test/zjy/ /test/zjy/
参数 用户@地址:挂载到 挂载到
nonempty 允许安装在非空文件/DIR上
allow_other 允许访问其他用户
mount -a 重新加载挂载信息
四、查看
查看当前系统挂载:
[root@xiaoyuer ~]# cat /etc/mtab
/dev/vda1 / ext3 rw,noatime,acl,user_xattr 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw,mode=0620,gid=5 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
root@192.168.1.121:/test/ /test/zjy fuse.sshfs rw,nosuid,nodev,allow_other 0 0 添加到自动挂载:
root@192.168.1.121:/test/ /test/zjy fuse.sshfs rw,nosuid,nodev,allow_other 0 0
五、卸载命令
umount -f /test/zjy/
六、如果想免秘钥(可以做ssh免秘钥)
1.ssh免秘钥登录/挂载: ssh-keygen -t rsa [root@xiaoyuer ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
b0:9d:41:56:b5:c4:b2:0e:0d:47:07:4d:fa:4c:47:03 root@xiaoyuer
The key's randomart image is:
+--[ RSA 2048]----+
| oo+*E.o |
| o. o+oo . |
| . .+.oo . |
| +.oo+ . |
| . So o |
| . |
| |
| |
| |
+-----------------+ 2.把公钥复制到服务器上 ssh-copy-id -i ~/.ssh/id_rsa.pub root@xx.xx.xx.xx [root@xiaoyuer ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.1.121
root@192.168.1.121's password:
Now try logging into the machine, with "ssh 'root@192.168.1.121'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting. 3.测试
[root@xiaoyuer ~]# ssh root@xx.xx.xx.xx 测试成功在挂载就不需要数据密码
sshfs远程挂载的更多相关文章
- 使用sshfs来挂载远程的文件
只要安装sshfs就可以通过ssh的端口来远程挂载文件夹, 不需要其他额外的配置非常的方便. 这个软件在只有ssh权限的情况下远程范围文件是非常有用的. 1. 安装sshfs 2. 用法非常简单 ...
- linux nfs远程挂载和卸载
一.nfs远程挂载 1.首先确定服务端(实体挂载节点)的IP 2.通过cat /etc/hosts 查看服务端的server name 3.mount -t nfs servername:/挂载文件 ...
- Linux上利用NFS实现远程挂载
两台服务器 192.168.1.1 [WEB服务器] 192.168.1.2 [录音服务器] 说明 在192.168.1.2服务器上每天有许多录音文件生成,192.168.1.1作为WEB服务器,里面 ...
- sshfs远程文件系统挂载
注意:转载请注明出处: http://www.programfish.com/blog/?p=145 sshfs简介: 一种通过SSH协议访问远程文件系统的用户空间文件系统.可以把远程主机上的文件系统 ...
- RHCE之配置autofs远程挂载远程服务器的家目录
[root@server0 ~]# yum -y install autofs 安装包 [root@server0 ~]# vim /etc/auto.master ...
- Linux下配置nfs并远程挂载实战探讨
简单介绍: nfs是网络文件系统,允许一个节点通过网络访问远程计算机的文件系统,远程文件系统可以被直接挂载到本地,文件操作和本地没有区别,如果是局域网的nfs那么io的性能也可以保证 nfs是Netw ...
- Linux下配置nfs并远程挂载
nfs是网络文件系统,允许一个节点通过网络访问远程计算机的文件系统,远程文件系统可以被直接挂载到本地,文件操作和本地没有区别,如果是局域网的nfs那么io的性能也可以保证,下面就以CentOS 7.x ...
- (转) Linux下配置nfs并远程挂载
nfs是网络文件系统,允许一个节点通过网络访问远程计算机的文件系统,远程文件系统可以被直接挂载到本地,文件操作和本地没有区别,如果是局域网的nfs那么io的性能也可以保证,下面就以CentOS 7.x ...
- sshfs的挂载与卸载
在CentOS中 sshfs的使用依赖EPEL(只安装sshfs不会出错,但是却无法使用) 挂载 安装EPEL rpm -i https://dl.fedoraproject.org/pub/epel ...
随机推荐
- iOS:练习题中如何用技术去实现一个连线题
一.介绍 本人做的app涉及的是教育行业,所以关于练习题的开发肯定是家常便饭.例如,选择题.填空题.连线题.判断题等,每一种题型都需要技术去实现,没啥多大难度,这里呢,就给出实现连线题的核心代码吧.过 ...
- Data type conversion in MongoDB
[问题] I have a collection called Document in MongoDB. Documents in this collection have a field calle ...
- jsp执行过程图解
转自:https://blog.csdn.net/y277an/article/details/76561451 一.jsp执行过程图解 用户访问jsp页面时,jsp的处理过程如下图所示: 二.预处理 ...
- hive sql 常见异常
1.union Logging initialized using configuration in file:/home/xiaoju/hadoop/apache-hive-1.2.1-bin/co ...
- GopherChina 2018
https://github.com/gopherchina/conference/tree/master/2018
- 【C++】解析C++运行环境的搭建
在本篇文章中,笔者会谈谈如何搭建C++的运行环境.在不同操作系统中,运行C++编译器的命令也各不相同,最常用的编译器是GNU编译器(Linux系统)和微软Visual Studio编译器(Window ...
- Elasticsearch索引mapping的写入、查看与修改(转)
mapping的写入与查看 首先创建一个索引: curl -XPOST "http://127.0.0.1:9200/productindex" {"acknowledg ...
- C++数值类型与string的相互转换
转自:https://www.cnblogs.com/johngu/p/7878029.html 1.数值类型转换为string 1.1使用函数模板+ostringstream 使用函数模板将基本数据 ...
- 【交换机】交换机RLDP(环路检测&链路检测)功能介绍及配置说明
功能简介RLDP 全称是Rapid Link Detection Protocol,是锐捷网络自主开发的一个用于快速检测以太网链路故障的链路协议.一般的以太网链路检测机制都只是利用物理连接的状态,通过 ...
- libGDX开发环境搭建-Android Studio 最新版
http://blog.csdn.net/renwuqiangg/article/details/53088720 —————————————————————————————————————————— ...