How to SSH login password free from Windows, Linux, Mac
It's very painful and annoying to always provide password for ssh login. But it can be fixed by auto password functionality of ssh
Table of contents
1. Linux OS & MAC OS
Run the following command on your bash (or any alternative like zsh, fish, etc) to set up auto ssh login.
ssh-copy-id -i "<Public key path>" "<user.name@email.com@host_ip_adress>"
Example:
Output:
2. Windows
Run the following commands, in a local PowerShell window replacing user and host name as appropriate to copy your local public key to the SSH host.
$USER_AT_HOST="your-user-name-on-host@hostname"
$PUBKEYPATH="$HOME\.ssh\id_rsa.pub"
$pubKey=(Get-Content "$PUBKEYPATH" | Out-String); ssh "$USER_AT_HOST" "mkdir -p ~/.ssh && chmod 700 ~/.ssh && echo '${pubKey}' >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
Example:
Output: