# How to setup Passwordless SSH
###### tags: `guide` `ssh`
## On the local Machine
### For Linux system
Run the below commands only
```shell=
ssh-keygen
ssh-copy-id
```
### For windows
Open cmd and run
```shell=
ssh-keygen
```
This is a once in a lifetime time command 😂. Dont run it again and again otherwise it will replace your old keys which might have been used to login to other servers. If you already have ran this command, you will have keys in .ssh folder and you can use that for next steps.
Then Manually copy files
1. Once key is generated, go to run and type `.ssh`
2. Copy content local `id_rsa.pub` to remote directory file `~/.ssh/authorized_keys`
*(Optional) You can use scp as well*
## On the server
- Do an ssh to your server using `ssh yourusername@servername.xyz`
- Check if `.ssh` folder and `.ssh/authorized_keys` file is alredy present. If not present use the below command
```shell=
mkdir ~/.ssh
touch ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
```
Copy content of local pc `id_rsa.pub` to remote server file `~/.ssh/authorized_keys`
You may also need to change/verify the permissions of your home directory to remove write access for the group and others.
```shell=
chmod go-w ~
```
source: [Stack Overflow](https://stackoverflow.com/questions/6377009/adding-a-public-key-to-ssh-authorized-keys-does-not-log-me-in-automatically)
## Misc Tips
- Get all info about PID `ps -f <PID>`
## Contributer
- Rohit Lal - https://rohitlal.net