Passwordless SSH HowTo: Difference between revisions
No edit summary |
No edit summary |
||
Line 9: | Line 9: | ||
== Connecting to the LWP from home with SSH.== | == Connecting to the LWP from home with SSH.== | ||
Replace '''ssh.lwp.rug.nl''' with the hostname of the machine you're trying to connect to.<br> | Replace '''ssh.lwp.rug.nl''' with the hostname of the machine you're trying to connect to.<br> | ||
===Add your p-number to the allowed users list=== | |||
Add your p-number to the file /etc/users_allowed_ssh. | |||
===Create a new SSH key pair=== | ===Create a new SSH key pair=== | ||
Create a key pair using the following command:<br> | Create a key pair using the following command:<br> |
Revision as of 17:22, 17 February 2023
It's possible to use SSH to connect to your LWP directly. To connect to any LWP from outside the university network we require 2 factor authentication. This is achieved by requiring a password and a ssh key to login.
We have a login server available to access your home directory, so you don't have to leave your own PC turned on. It's not a big machine, so don't use it to do your work on or you'll bother other users trying to access their files.
The login server ssh-hostkeys:
2048 SHA256:BqwCk82bRDxY3YLkumDcr8d0RKExSCX+zbsgdDyfF4w ssh.lwp.rug.nl (RSA)
256 SHA256:MfSPCbM20GbH+zMDUAEFzk80vTxF2890ch2EQJjEi3o ssh.lwp.rug.nl (ED25519)
256 SHA256:Fck7jcOsqDtqcCFncx144z2tt12oMWXD4Jiz0LJbapw ssh.lwp.rug.nl (ECDSA)
Connecting to the LWP from home with SSH.
Replace ssh.lwp.rug.nl with the hostname of the machine you're trying to connect to.
Add your p-number to the allowed users list
Add your p-number to the file /etc/users_allowed_ssh.
Create a new SSH key pair
Create a key pair using the following command:
ssh-keygen -t rsa -b 4096 -C "LWP" -f ~/.ssh/lwp_rsa
Note: You can enter any comment with the “-C” option, e.g. username@hostname, so you can easily see what you're using the key for. The “-C” option is not mandatory.
Add your public key to the authorized_keys file
To allow your account to login to the LWP you'll have to add your public key to a authorized_keys file:
cat ~/.ssh/lwp_rsa.pub >> ~/.ssh/authorized_keys
Note: This can only be done if you're logged in to a LWP, but because of COVID that isn't an option for most, therefore you can send us your public key and a picture of your RUG-pas (so we can verify it's you) then we'll add it for you.
Set up your own system
Use a USB drive to transfer your key pair to your own system securely.
cp ~/.ssh/lwp_rsa* /media/<your usb device>/
Copy your key pair to your home directory:
mkdir ~/.ssh cp /media/<your usb device>/lwp_rsa* ~/.ssh/
Set the correct permissions:
chmod 0700 ~/.ssh chmod 0600 ~/.ssh/lwp_rsa
Try the connection:
ssh -i ~/.ssh/lwp_rsa <username>@ssh.lwp.rug.nl
Make your life easier by creating a ~/.ssh/config file and adding the following:
host lwp user <username> IdentityFile ~/.ssh/lwp_rsa ForwardX11 yes HostName ssh.lwp.rug.nl
Then connect with:
ssh lwp
Enter your password and you should find yourself in your home directory.