配置主机间信任的一个简单办法。

本文详细介绍了如何在多个机器间配置SSH免密登录的过程。包括生成公钥和私钥对、将公钥添加到目标主机的authorized_keys文件中等步骤。通过这些步骤,可以实现在不同主机间的无缝SSH连接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

只列出在一个机器上的操作。从rac01-ud-us-eqx到rac02-ud-us-eqx和rac03-ud-us-eqx

bash-3.00$ ssh 10.12.32.182
The authenticity of host '10.12.32.182 (10.12.32.182)' can't be established.
RSA key fingerprint is 7e:8d:db:aa:7c:15:3e:b6:4e:5f:86:58:b5:e8:97:7a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.12.32.182' (RSA) to the list of known hosts.
Password:
Password:
Password:
Permission denied (gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive).
bash-3.00$
bash-3.00$
bash-3.00$ /usr/bin/ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/export/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /export/home/oracle/.ssh/id_rsa.
Your public key has been saved in /export/home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
73:a0:e2:39:0b:6a:f5:b2:90:63:2d:a0:8b:20:96:af oracle@rac01-ud-us-eqx
bash-3.00$  /usr/bin/ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/export/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /export/home/oracle/.ssh/id_dsa.
Your public key has been saved in /export/home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
5b:f6:0b:e5:2d:85:04:1c:85:84:52:de:ac:a1:27:f1 oracle@rac01-ud-us-eqx
bash-3.00$ ssh rac01-ud-us-eqx cat /export/home/oracle/.ssh/id_rsa.pub >>authorized_keys
The authenticity of host 'rac01-ud-us-eqx (10.12.32.181)' can't be established.
RSA key fingerprint is a5:b1:df:ea:ca:b5:78:69:43:cb:2b:cb:de:9f:f1:5d.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'rac01-ud-us-eqx,10.12.32.181' (RSA) to the list of known hosts.
Password:
bash-3.00$ ssh rac01-ud-us-eqx cat /export/home/oracle/.ssh/id_dsa.pub >>authorized_keys
Password:
bash-3.00$ ssh rac02-ud-us-eqx cat /export/home/oracle/.ssh/id_rsa.pub >>authorized_keys
The authenticity of host 'rac02-ud-us-eqx (10.12.32.182)' can't be established.
RSA key fingerprint is 7e:8d:db:aa:7c:15:3e:b6:4e:5f:86:58:b5:e8:97:7a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'rac02-ud-us-eqx' (RSA) to the list of known hosts.
Password:
bash-3.00$ ssh rac02-ud-us-eqx cat /export/home/oracle/.ssh/id_dsa.pub >>authorized_keys
Password:
bash-3.00$ scp authorized_keys rac02-ud-us-eqx:/export/home/oracle/.ssh
Password:
authorized_keys      100% |*********************************************************************************|  2532       00:00   
bash-3.00$  ssh rac02-ud-us-eqx
Last login: Wed Apr 21 02:28:53 2010 from rac01-ud-us-eqx
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
$ exit
Connection to rac02-ud-us-eqx closed.
bash-3.00$ ssh rac03ud-us-eqx cat /export/home/oracle/.ssh/id_rsa.pub >>authorized_keys
ssh: rac03ud-us-eqx: node name or service name not known
bash-3.00$ ssh rac03-ud-us-eqx cat /export/home/oracle/.ssh/id_rsa.pub >>authorized_keys
The authenticity of host 'rac03-ud-us-eqx (10.12.32.183)' can't be established.
RSA key fingerprint is 01:d0:d1:4c:6b:4e:00:fe:d1:c0:33:5d:fd:56:2f:19.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'rac03-ud-us-eqx,10.12.32.183' (RSA) to the list of known hosts.
Password:
bash-3.00$ ssh rac03ud-us-eqx cat /export/home/oracle/.ssh/id_dsa.pub >>authorized_keys
ssh: rac03ud-us-eqx: node name or service name not known
bash-3.00$ ssh rac03-ud-us-eqx cat /export/home/oracle/.ssh/id_dsa.pub >>authorized_keys
Password:
bash-3.00$ scp authorized_keys rac03-ud-us-eqx:/export/home/oracle/.ssh
Password:
authorized_keys      100% |*********************************************************************************|  3376       00:00   
bash-3.00$  ssh rac03-ud-us-eqx
Last login: Wed Apr 21 02:31:14 2010 from rac01-ud-us-eqx
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
$ exit
Connection to rac03-ud-us-eqx closed

### 解决 RedisDesktopManager 无法手动添加连接或服务器的问题 当遇到 RedisDesktopManager (RDM) 无法手动添加连接或服务器的问题时,通常涉及几个方面的原因分析和排查措施。以下是详细的解决方案: #### 1. 检查防火墙设置 确保 Linux 系统上的防火墙允许 Redis 默认端口(通常是 6379)通过。可以使用命令 `firewall-cmd --add-port=6379/tcp` 来开放该端口[^3]。 #### 2. 验证网络配置 如果目标 Redis 实例位于私有网络中,则外部访问需要额外的安全组规则或 SSH 跳板机来建立隧道。对于公有云环境下的实例,建议确认安全组已正确配置并放开了必要的入站流量规则[^4]。 #### 3. 修改 Redis 配置文件 编辑 `/etc/redis.conf` 或者其他位置的配置文件,取消绑定本地地址(`bind 127.0.0.1`) 的限制,并重启服务使更改生效。注意这样做会暴露 Redis 到公网,请务必配合严格的认证机制一起实施[^1]。 ```bash sudo nano /etc/redis.conf # 注释掉 bind 行或者指定可信任 IP 地址范围 # bind 127.0.0.1 ::1 ``` #### 4. 设置密码保护 为了提高安全性,在生产环境中应该启用密码验证功能。可以在上述提到的配置文件里找到如下选项并修改: ```properties requirepass your_strong_password_here ``` 保存后记得再次启动 Redis 服务以应用新参数。 #### 5. 使用 RDM 添加远程连接 打开 RedisDesktopManager 应用程序,点击左下角 "+" 号创建新的数据库链接项。输入主机名/IP、端口号以及之前设定好的密码完成配置过程。如果有任何错误提示信息,请仔细阅读官方文档获取更多帮助[^2]。 #### 6. 测试连接稳定性 利用 telnet 工具简单测试一下 TCP 层面能否正常握手成功: ```bash telnet <your_redis_host> 6379 Trying ... Connected to ... Escape character is '^]' . ``` 若能顺利进入交互模式则说明基础通信无碍,反之需进一步检查前面几步操作是否有遗漏之处。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值