Я копирую свой открытый ключ на другую машину, используя ssh-copy-id.
$ sudo ssh-copy-id -i /home/vagrant/.ssh/id_rsa.pub vagrant@datanode1.com /bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/vagrant/.ssh/id_rsa.pub" The authenticity of host 'datanode1.com (192.168.10.34)' can't be established. ECDSA key fingerprint is SHA256:3BRYoZLj01hdxmOtJ0o6XLgzO90DHvLdHYHnuhXHWQE. ECDSA key fingerprint is MD5:e0:f1:fa:ce:39:56:a3:93:bc:be:9f:1c:65:79:6b:6b. Are you sure you want to continue connecting (yes/no)? yes /bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys vagrant@datanode1.com's password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'vagrant@datanode1.com'" and check to make sure that only the key(s) you wanted were added. В любом случае я могу сделать это молча.
Я имею в виду без запроса Are you sure you want to continue connecting (yes/no)?и пароляvagrant@datanode1.com's password:
Есть ли способ, которым я могу достичь того же.
да, пожалуйста, обратитесь к этому похожему вопросу: https://stackoverflow.com/questions/31908788/how-to-sshpass-ssh-copy-id