快速创建SSH信任实现无密码登录

1. 生成本机的公私钥匙对
[oracle@Oracle11_2 scripts]$ ssh-keygen -b 1024 -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/oracle/.ssh/id_rsa): (Enter) Created directory '/home/oracle/.ssh'. Enter passphrase (empty for no passphrase): (Enter) Enter same passphrase again: Your identification has been saved in /home/oracle/.ssh/id_rsa. Your public key has been saved in /home/oracle/.ssh/id_rsa.pub. The key fingerprint is: (Enter) ab:a8:93:25:50:f8:32:3f:f5:fd:c3:8b:97:98:7b:e6 oracle@Oracle11_2 The key's randomart image is: (Enter) +--[ RSA 1024]----+ | . | |. . | | o | |+ . . | | = . . .S | | + . . .. | | = .= . | | o . .o.O | | .o. . o*Eo | +-----------------+


2. 将本机的公钥复制到远程机器的authorized_keys文件中,ssh-copy-id也能让你有到远程机器的home, ~./ssh , 和 ~/.ssh/authorized_keys的权利 [oracle@Oracle11_2 scripts]$ ssh-copy-id -i ~/.ssh/id_rsa.pub Oracle11 The authenticity of host 'oracle11 (192.168.199.67)' can't be established. RSA key fingerprint is 54:94:e3:2c:5b:92:f2:a5:03:e0:2c:73:b9:72:dd:d6. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'oracle11,192.168.199.67' (RSA) to the list of known hosts. oracle@oracle11's password: Now try logging into the machine, with "ssh 'Oracle11'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting.
3. 测试 [oracle@Oracle11_2 scripts]$
ssh Oracle11 [oracle@Oracle11 ~]$ exit logout Connection to Oracle11 closed.

 

参考:http://blog.chinaunix.net/uid-26284395-id-2949145.html

http://blog.sina.com.cn/s/blog_68158ebf0100vf8l.html

转载于:https://www.cnblogs.com/storymedia/p/4547188.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值