Last active
February 23, 2021 19:10
-
-
Save cristiarg/cd2c3ac6a64720f7c4a8150fe6521764 to your computer and use it in GitHub Desktop.
passwordless ssh login into remote server
This file contains hidden or 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
# either use existing authentication keys, check with: | |
ll ~/.ssh/id_* | |
# if none exist that can be reused, | |
# or generate a new key with | |
ssh-keygen -t rsa | |
# which will automatically generate private/public keys as ~/.ss/id_*[.pub] | |
# check again with | |
ll ~/.ssh/id_* | |
# copy the public key to the remote server with; by default, this will copy the most recent | |
# key to the remote server, if that is not the case, use the '-i' option | |
ssh-copy-id remote_username@server_remote_name_or_ip_address | |
# check that the public key was appended on the remote server in ~/.ssh/authorized_keys | |
# now passwordless login should work | |
# if it does not, check that on the remote (an probably on the local as well) the following is true | |
chmod 700 ~/.ssh | |
chmod 600 ~/.ssh/authorized_keys | |
# moreso, check also that the following is true on the remote (and probably on the local as well) | |
chmod go-w ~ | |
# Reference: | |
# - https://www.techjunkie.com/ssh-login-without-key-password/ | |
# - https://stackoverflow.com/questions/6377009/adding-a-public-key-to-ssh-authorized-keys-does-not-log-me-in-automatically |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment