linux(ubuntu)2台互相ssh无密码访问
来源:互联网 发布:完美汽配软件 编辑:程序博客网 时间:2024/05/17 04:43
最佳方式:
1. sudo apt-get update
2. 安装ssh
sudo apt-get install openssh-server
3. 生成公钥
ssh-keygen -t rsa
以上3步骤AB机器均需要实现(已完成12步骤的可以只进行3)
在主机A上实现:
4. cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
5. ssh 192.168.1.148 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
6. scp ~/.ssh/authorized_keys 192.168.1.148:~/.ssh/authorized_keys
7. 修改文件权限
cd ~/.ssh
sudo chmod 755 .ssh 以及 sudo chmod 644 authorized_keys
8. ssh-add
这样A便能ssh无密码访问B,其中192.168.1.148为主机B的ip地址
若要实现Bssh无密码访问A,则需要在主机B上执行4-8步骤
实际场景(采用链接1):
hadoop@Slave1-hadoop:~$ sudo service ssh start
[sudo] password for hadoop:start: Job is already running: ssh
hadoop@Slave1-hadoop:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hadoop/.ssh/id_rsa):
Created directory '/home/hadoop/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/hadoop/.ssh/id_rsa.
Your public key has been saved in /home/hadoop/.ssh/id_rsa.pub.
The key fingerprint is:
42:49:47:44:69:f6:b1:13:ae:e5:28:23:5f:f6:74:9b hadoop@Slave1-hadoop
The key's randomart image is:
+--[ RSA 2048]----+
| .+=. |
| . o+ o |
| oo o + |
| . * |
| . S= . |
| . o.= o . |
| o = o . o |
| . . E |
| |
+-----------------+
hadoop@Slave1-hadoop:~$ cd .ssh
hadoop@Slave1-hadoop:~/.ssh$ cat id_rsa.pub >> authorized_keys
hadoop@Slave1-hadoop:~/.ssh$ scp id_rsa.pub 166.111.82.38@Slave2-hadoop:/home/hadoop/id_rsa.pub
参考链接:
1.http://jingyan.baidu.com/article/3f16e003c918092591c103a2.html
2. http://www.it165.net/os/html/201311/6595.html
- linux(ubuntu)2台互相ssh无密码访问
- linux(ubuntu)ssh无密码访问题
- 多台linux服务器ssh相互无密码访问
- 多台linux服务器ssh相互无密码访问
- 多台linux服务器ssh相互无密码访问
- 多台linux服务器ssh相互无密码访问
- 多台linux电脑无密码互相登录
- SSH实现两台Linux主机无需密码互相登录
- SSH实现两台Linux主机无需密码互相登录
- 设置多台服务器相互ssh无密码访问
- 全面介绍Linux ssh无密码访问
- SSH无密码远程访问Linux主机
- Linux SSH 无密码访问设置详解
- linux配置ssh无密码访问
- Linux系统下通过ssh无密码互相链接
- ssh无密码访问
- SSH无密码访问
- ssh无密码访问
- python Django后台开发笔记11
- 第五天 App编程开发【跟着大磨马学IT编程(安卓java)】
- Android布局优化 merge标签使用
- 安卓webView实现长按二维码的自动识别功能
- linux下删除mysql
- linux(ubuntu)2台互相ssh无密码访问
- 友元函数与成员函数的一点区别
- leetcode-144-Binary Tree Preorder Traversal
- jQuery源码分析系列
- NIST and Quantum Computers
- Android之SurfaceView学习(一)
- UGUI逐帧动画
- UVA 1220(p282)----Party at Hali-Bula
- go语言指针访问结构体的方法