# How to SSH login password free from Windows, Linux, Mac

# 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.

```bash
ssh-copy-id -i "<Public key path>" "<user.name@email.com@host_ip_adress>"
``` 
**Example: **
![Linux example](https://cdn.hashnode.com/res/hashnode/image/upload/v1643733668913/hPPU_frxO.png)

**Output:**
![Screenshot 2021-10-29 132602.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1643734030037/MPMD6Lp9r.png)

# 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.

```powershell
$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: **
![Screenshot 2021-10-29 132457.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1643734429263/2WxRmpmJT.png)

**Output:**
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1643734641245/n45GsJTje.png)

