Last active
October 7, 2017 15:59
-
-
Save vutranvn/07f890daa7d1f19dfcc38728bbb5628f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
** Client Machine ** | |
- Create ssh key | |
> ssh-keygen -t rsa | |
- Key is saved default at ~/.ssh/id_rsa | |
- Enter passphrase | |
- Copy public key ~/.ssh/id_rsa.pub | |
> pbcopy < ~/.ssh/id_rsa.pub OR cat ~/.ssh/id_rsa.pub | |
** Server ** | |
- Create directory .ssh | |
> mkdir -p ~/.ssh | |
- Paste public key to file ~/.ssh/authorized_keys | |
> chmod 700 -R ~/.ssh | |
> chmod 600 ~/.ssh/authorized_keys | |
- Turn off password | |
> nano /etc/ssh/sshd_config | |
- Find and setting | |
PasswordAuthentication no | |
UsePAM no | |
> systemctl reload ssh | |
NOTE: SSH Key doesn't working if SELinux ON. To disable SELinux: | |
> nano /etc/selinux/config | |
- Find and Replace SELINUX=enforcing to SELINUX=disabled | |
- Reboot server |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment