Difference between revisions of "SSH"
m |
m |
||
(2 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
Log in with your computer account and at the command line run:<br /> | Log in with your computer account and at the command line run:<br /> | ||
ssh-keygen -t rsa -b 4096 -C " | '''ssh-keygen -t rsa -b 4096 -C "youremail@example.com"''' | ||
This will create the ".ssh" folder, and inside that folder will generate two files, one is the private key "id_rsa", and the other the public key "id_rsa.pub". | This will create the ".ssh" folder, and inside that folder will generate two files, one is the private key "id_rsa", and the other the public key "id_rsa.pub". | ||
Line 14: | Line 14: | ||
# Log in with the account that was assigned to you | # Log in with the account that was assigned to you | ||
# On terminal make sure you are at your account home directory: '''cd ~/''' | # On terminal make sure you are at your account home directory: '''cd ~/''' | ||
# If the ".ssh" folder doesn't exist, create one: | # If the ".ssh" folder doesn't exist, create one: '''mkdir .ssh''' | ||
# Set the 700 permissions to .ssh: '''sudo chmod 700 .ssh''' | # Set the 700 permissions to .ssh: '''sudo chmod 700 .ssh''' | ||
# Now change directory: '''cd .ssh''' | # Now change directory: '''cd .ssh''' | ||
Line 23: | Line 23: | ||
'''From your computer:'''<br /> | '''From your computer:'''<br /> | ||
Now, to connect to the server that has your public key, and assuming that the server is using port 22786 for SSH:<br /> | Now, to connect to the server that has your public key, and assuming that the server is using port 22786 for SSH:<br /> | ||
ssh -p 22786 user@host | '''ssh -p 22786 user@host''' | ||
Thanks! | Thanks! |
Latest revision as of 00:53, 14 April 2021
SSH LOGIN WITH SSH CERTIFICATE
On your computer:
Adding your email address to your public key is optional. It will help the server administrator (and Feds) to ID whose public key is it. If you don't want it there, don't type it.
In the process of generating this SSH certificate/keys you will be prompted to set a passphrase. This passphrase will be required every time you want to connect to a server that has your public key.
Log in with your computer account and at the command line run:
ssh-keygen -t rsa -b 4096 -C "youremail@example.com"
This will create the ".ssh" folder, and inside that folder will generate two files, one is the private key "id_rsa", and the other the public key "id_rsa.pub". The public key is the one that you share. NEVER share the private key.
On the target/server computer:
- Log in with the account that was assigned to you
- On terminal make sure you are at your account home directory: cd ~/
- If the ".ssh" folder doesn't exist, create one: mkdir .ssh
- Set the 700 permissions to .ssh: sudo chmod 700 .ssh
- Now change directory: cd .ssh
- If the "authorized_keys" file doesn't exist, create one: touch authorized_keys
- Set the 644 permissions: sudo chmod 644 authorized_keys
- And finally, copy and save your public key in this "authorized_keys" file: sudo nano authorized_keys
From your computer:
Now, to connect to the server that has your public key, and assuming that the server is using port 22786 for SSH:
ssh -p 22786 user@host
Thanks!