1

I'm on a MacBook Pro running the latest OS and im connecting to a server in Terminal using the ssh command to connect to one of my university's servers. we connect using our username then must punch in a PW to gain access to the server and I was told that there was a way to configure my settings so that I wouldn't have to type my password every time I wanted to connect to the server.

Is it a setting on my computer or do I have to configure it through Terminal?

0

First, on the local machine you will want to generate a secure SSH key:

ssh-keygen

Walk through the key generator and set a password, the key file by default goes into ~/.ssh/id_rsa

Next, you need to copy the generated key to the remote server you want to setup passwordless logins with, this is easily done with the following command:

cat ~/.ssh/id_dsa.pub | ssh user@remotehost 'cat >> ~/.ssh authorized_keys'

This command takes the generated SSH key from the local machine, connects to the remote host via SSH, and then uses cat to append the key file to the remote users authorized key list. Because this connects with SSH to the remote machine you will need to enter the password to use this command.

Finally, confirm that you can now login to the remote SSH server without a password:

ssh user@remotehost.com

Assuming initial setup went as intended, you will connect to the remote machine without having to log in.

0

Sorry, but I can't post a comment. You can look at some solutions here: askubuntu.com/questions/46930/how-can-i-set-up-password-less-ssh-login

I did find another solution though:
In Terminal (on your device), do ssh-keygen, then keep pressing enter (don't put anything for password) until you get the terminal prompt again, then type
ssh-copy-id -i ~/.ssh/id_rsa.pub username@ip_address Then try to login with

ssh username@ip_address

  • This answer is insecure because it does not set a passphrase to encrypt the private key. If someone would obtain an unencrypted private key he would have passwordless access to the server. On OSX the ssh-agent is nicely integrated with the keychain, therefore you never need to type the passphrase once logged on. – bbaassssiiee Feb 9 '16 at 7:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.