https://github.com/sk3pp3r/wizard-ssh-copy-id
Automating ssh-copy-id Answer “Yes” and copy the password by using sshpass
https://github.com/sk3pp3r/wizard-ssh-copy-id
bash sk3pp3r ssh ssh-copy-id sshpass
Last synced: about 1 year ago
JSON representation
Automating ssh-copy-id Answer “Yes” and copy the password by using sshpass
- Host: GitHub
- URL: https://github.com/sk3pp3r/wizard-ssh-copy-id
- Owner: sk3pp3r
- License: mit
- Created: 2020-02-27T08:12:16.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-11-07T09:16:20.000Z (over 3 years ago)
- Last Synced: 2025-01-23T07:47:32.077Z (about 1 year ago)
- Topics: bash, sk3pp3r, ssh, ssh-copy-id, sshpass
- Language: Shell
- Size: 6.84 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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 answering`YES` 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
* [ssh](https://www.ssh.com/ssh/command)
* [ ssh-copy-id](https://www.ssh.com/ssh/copy-id)
* [sshpass](https://linux.die.net/man/1/sshpass)