设置ssh免密登录 非22端口

如下 需要做一个 3000端口的免密登录 还是传统的配方 还是原来的味道 但是报错了 不行

[username@localhost ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/username/.ssh/id_rsa): 
/home/username/.ssh/id_rsa already exists.
Overwrite (y/n)? 
[username@localhost ~]$ ssh-copy-id -p 3000 -i ~/.ssh/id_rsa.pub  username@172.16.0.247
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/username/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/usr/bin/ssh-copy-id: ERROR: ssh: connect to host 172.16.0.247 port 3000: Connection refused

正确姿势 如下

[username@localhost ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub   -p3000 username@172.16.0.247
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/username/.ssh/id_rsa.pub"
The authenticity of host '172.16.0.247 (172.16.0.247)' can't be established.
ECDSA key fingerprint is SHA256:HBk6Q7eZtLtMzxeOKFgLnrmv1581RMQ2ywzH25LV2lg.
ECDSA key fingerprint is MD5:ff:82:60:72:1e:f2:5d:3a:77:c5:ae:7b:2c:51:1a:3f.
Are you sure you want to continue connecting (yes/no)? 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值