歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux服務器

Linux系統下分發SCP不需要輸入密碼配置

 首先在每個節點執行一下命令腳本

    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 [email protected]:/home/adsit/

    scp -r /usr/local/adsit/webapps/preroll/WEB-INF/classes [email protected]:/home/adsit/

    在分發主機執行 scp.sh 實現拷貝功能。

Copyright © Linux教程網 All Rights Reserved