linux 下两台电脑之间ssh无密码连接
例子:在192.168.0.12使用tecmint用户,连接192.168.0.11主机上的sheena用户
Step 1: Create Authentication SSH-Kegen Keys on – (192.168.0.12)
First login into server 192.168.0.12 with user tecmint and generate a pair of public keys using following command.
[tecmint@tecmint.com ~]$ ssh-keygen -t rsa Generating public/private rsa key pair.
Enter file in which to save the key (/home/tecmint/.ssh/id_rsa): [Press enter key]
Created directory '/home/tecmint/.ssh'.
Enter passphrase (empty for no passphrase): [Press enter key]
Enter same passphrase again: [Press enter key]
Your identification has been saved in /home/tecmint/.ssh/id_rsa.
Your public key has been saved in /home/tecmint/.ssh/id_rsa.pub.
The key fingerprint is:
5f:ad:40:00:8a:d1:9b:99:b3:b0:f8:08:99:c3:ed:d3 tecmint@tecmint.com
The key's randomart image is:
+--[ RSA 2048]----+
| ..oooE.++|
| o. o.o |
| .. . |
| o . . o|
| S . . + |
| . . . o|
| . o o ..|
| + + |
| +. |
+-----------------+
Step 2: Create .ssh Directory on – 192.168.0.11
Use SSH from server 192.168.0.12 to connect server 192.168.0.11 using sheena as user and create .sshdirectory under it, using following command.
[tecmint@tecmint ~]$ ssh sheena@192.168.0.11 mkdir -p .ssh The authenticity of host '192.168.0.11 (192.168.0.11)' can't be established.
RSA key fingerprint is 45:0e:28:11:d6:81:62:16:04:3f:db:38:02:la:22:4e.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.11' (ECDSA) to the list of known hosts.
sheena@192.168.0.11's password: [Enter Your Password Here]
Step 3: Upload Generated Public Keys to – 192.168.0.11
Use SSH from server 192.168.0.12 and upload new generated public key (id_rsa.pub) on server 192.168.0.11under sheena‘s .ssh directory as a file name authorized_keys.
[tecmint@tecmint ~]$ cat .ssh/id_rsa.pub | ssh sheena@192.168.0.11 'cat >> .ssh/authorized_keys' sheena@192.168.1.2's password: [Enter Your Password Here]
Step 4: Set Permissions on – 192.168.0.11
Due to different SSH versions on servers, we need to set permissions on .ssh directory and authorized_keys file.
[tecmint@tecmint ~]$ ssh sheena@192.168.0.11 "chmod 700 .ssh; chmod 640 .ssh/authorized_keys" sheena@192.168.0.11's password: [Enter Your Password Here]
Step 5: Login from 192.168.0.12 to 192.168.0.11 Server without Password
From now onwards you can log into 192.168.0.11 as sheena user from server 192.168.0.12 as tecmint user without password.
[tecmint@tecmint ~]$ ssh sheena@192.168.0.11
linux 下两台电脑之间ssh无密码连接的更多相关文章
- Linux下 两台机器文件/文件夹 相互拷贝
Linux下 两台机器文件/文件夹 相互拷贝 设有两台机器 :A:*.101及 B:*.102. 把A下的.temp/var/a.txt拷贝到B机器的/text/目录下: 进入B机器:scp root ...
- Linux:两台服务器之间添加信任关系,进行远程操作的时候不需要输入密码
两台机器之间建立信任关系的步骤: 1. 在机器1上root用户执行ssh-keygen命令,生成建立安全信任关系的证书,直接Enter [root@CentOS64-x64 ~]# ssh-keyge ...
- linux下两台服务器文件实时同步方案设计和实现
inux下两台服务器文件实时同步方案设计和实现 假设有如下需求: 假设两个服务器: 192.168.0.1 源服务器 有目录 /opt/test/ 192.168.0.2 目标服务器 有目录 /o ...
- 批量实现多台服务器之间ssh无密码登录的相互信任关系
最近IDC上架了一批hadoop大数据业务服务器,由于集群环境需要在这些服务器之间实现ssh无密码登录的相互信任关系.具体的实现思路:在其中的任一台服务器上通过"ssh-keygen -t ...
- 集群中配置多台计算机之间ssh无密码登录的一种简便方法
当我们在配置多台计算,使之可以相互使用无密码登录-ssh,之前都是一台一台的配置,现在一台A上添加B,然后在另一台B上再次添加A,这样使得 authorized_keys中的内容相同,但时并不是完全相 ...
- linux下两台服务器文件实时同步方案实现-乾颐堂
假设有如下需求: 假设两个服务器: 192.168.0.1 源服务器 有目录 /opt/test/ 192.168.0.2 目标服务器 有目录 /opt/bak/test/ 实现的目的就是保持这两 ...
- Cisco Packet Tracer中两台电脑通信设置
Cisco Packet Tracer是网络初学者仿真模拟网络环境的必备工具.今天我们来模拟下两台电脑之间的通信. Cisco Packet Tracer版本6.2.0 一.添加设备 1.这里添加一个 ...
- Python_架构、同一台电脑上两个py文件通信、两台电脑如何通信、几十台电脑如何通信、更多电脑之间的通信、库、端口号
1.架构 C/S架构(鼻祖) C:client 客户端 S:server 服务器 早期使用的一种架构,目前的各种app使用的就是这种架构,它的表现形式就是拥有专门的app. B/S架构(隶属于C/ ...
- Linux 两台服务器之间传输文件和文件夹
今天处理一个项目要迁移的问题,突然发现这么多图片怎么移过去,可能第一时间想到的是先从这台服务器下载下来,然后再上传到另外一台服务器上面去,这个方法确实是可行,但是实在是太费时间了,今天我就教大家怎么快 ...
随机推荐
- mysql--1130ERROR
问题一:mysql 用户登录不用验证密码(用户已设密码) 安装好mysql 后,我发现我设立了密码,同样可以不用密码就能登陆 cmd>mysql cmd>select current_us ...
- linux删除某个php程序进程的组合命令
如,想要杀死正在运行的所有 main.php 进程: ps aux |grep main.php|grep -v grep|awk '{print $2}'|xargs kill -9 解析: ps ...
- 黄聪:No 'Access-Control-Allow-Origin' header is present on the requested resource解决办法
在.htaccess文件里面添加下面代码: <IfModule mod_headers.c> Header set Access-Control-Allow-Origin "*& ...
- Bootstrap整体架构
大多数Bootstrap的使用者都认为Bootstrap只是提供了CSS组件和JavaScript插件,其实CSS组件和JavaScript插件只是Bootstrap框架的表现形式而已,他们都是构建在 ...
- 堆block和栈block的区分
0. 问题所在 下面给出一段代码: - (NSArray*) getBlockArray { int num = 916; return [[NSArray alloc] initWithObject ...
- Mono addin 学习笔记 3
典型的基于Mono addin插件框架的应用程序有以下一个部分组成: 1. 主应用程序:提供了一系列的扩展点(Extension Point)供其他应用进行扩展: 2. 扩展插件: 其部署结构图如下为 ...
- 在win server 2003上安装SQL Server 2008的步骤
1.安装Microsoft .NET Framework 3.5 Service Pack 1,下载地址:http://www.microsoft.com/zh-cn/download/confirm ...
- lisp 题目
1.根据二叉树的中序,前序生成生成二叉树的后续 2.BFPRT算法
- MYSQL整理的语法
MYSQL整理的语法 http://www.cnblogs.com/suoning/p/5744849.html
- Linux:ssh连接服务器很慢
ssh连接服务器,如果很慢,可以进行如下处理: vi /etc/ssh/sshd_config#UseDNS yes改成:UseDNS no/etc/init.d/sshd restart ----- ...