Skip to content

Instantly share code, notes, and snippets.

@NguyenTrungTin
Created July 20, 2019 19:57
Show Gist options
  • Save NguyenTrungTin/4e1b54c07ed71aa5a3a8f87cdd328eb6 to your computer and use it in GitHub Desktop.
Save NguyenTrungTin/4e1b54c07ed71aa5a3a8f87cdd328eb6 to your computer and use it in GitHub Desktop.
Create ~/.ssh/authorized_keys on user's home folder
```sh
# Copy user public key
cd /home/username
mkdir -p .ssh
mkdir ~/.ssh/authorized_keys
vim ~/.ssh/authorized_keys
```
One go
```bash
cat ~/.ssh/id_rsa.pub | ssh USER@HOST "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment