加入收藏 | 设为首页 | 会员中心 | 我要投稿 汽车网 (https://www.0577qiche.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 系统 > 正文

Linux系统下分发SCP不需要输入密码操作

发布时间:2023-08-14 13:03:56 所属栏目:系统 来源:
导读:首先在每个节点执行一下命令脚本

mkdir -p ~/.ssh

chmod 700 ~/.ssh

/usr/bin/ssh-keygen -t rsa

然后再需要批量分发的主机上

touch ~/.ssh/authorized_keys

ssh 192.168.1.20 cat ~/.ssh/id_rsa.
首先在每个节点执行一下命令脚本

mkdir -p ~/.ssh

chmod 700 ~/.ssh

/usr/bin/ssh-keygen -t rsa

然后再需要批量分发的主机上

touch ~/.ssh/authorized_keys

ssh 192.168.1.20 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

说明:192.168.1.20是分发主机的ip地址

The authenticity of host 'linux1 (192.168.1.100)' can't be established.

RSA key fingerPRint is 2f:cc:a1:4f:2b:67:01:6a:d1:9e:0b:ab:c8:9e:57:a1.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'linux1,192.168.1.100' (RSA) to the list of known hosts.

Oracle@linux1's passWord: xxxxx

在需要分发的主机执行

chmod 600 ~/.ssh/authorized_keys

在分发主机验证

ssh 192.168.1.19 hostname

RS9

在分发主机上常见 scp.sh 文件

从分发主机192.168.1.20向 192.168.1.19、192.168.1.10 分发文件

scp -r /usr/local/adsit/webapps/preroll/WEB-INF/classes root@192.168.1.19:/home/adsit/

scp -r /usr/local/adsit/webapps/preroll/WEB-INF/classes root@192.168.1.10:/home/adsit/

在分发主机执行 scp.sh 实现拷贝功能。

(编辑:汽车网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章