Skip to content

Automating ssh-copy-id Answer “Yes” and copy the password by using sshpass

License

Notifications You must be signed in to change notification settings

sk3pp3r/wizard-ssh-copy-id

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

wizard-ssh-copy-id

Automating ssh-copy-id Answer “Yes” and copy the password by using sshpass

Here sample way how to execute ssh-copy-id with password by using sshpass and answeringYES for the first time connection

# install sshpass 
sudo apt-get install sshpass -y # ubuntu
sudo yum install -y sshpass # centos

TEMP_PASS="MySecurePassword" # The password to pass over ssh
USER="root" # The user we going to use
REMOTE="IP_or_FQDN" # The IP of remote machine

echo "yes \n" | sshpass -p $TEMP_PASS ssh-copy-id -o StrictHostKeyChecking=no $USER@$REMOTE

You need to mark the file as executable: chmod +x auto-ssh.sh

References


Buy Me A Coffee

About

Automating ssh-copy-id Answer “Yes” and copy the password by using sshpass

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages