How Safe is SSH ?

Hi,

I have a PowerMac, running Tiger; I have SSH (Remote Login) enabled; I have my firewall on; I have a Dynamic DNS hosting account setup; my router is set to forward traffic from port 4000 to port 22 on my PowerMac; I have a user password.

My question is: is it safe ? I want to be able to access my files via SFTP (SSH) on an FTP client when I travel. This allows me to do it but the paranoid person in me worries ...

(Of course, I know some people who have the DMZ open to their Mac without fear -- but I am paranoid.)

How safe (or unsafe) is what I have done ?

Thanks,
Damon

Dual 2.7 PowerMac G5; PowerBook G4 15", Mac OS X (10.4.7)

Posted on Sep 9, 2006 7:07 AM

Reply
12 replies

Sep 10, 2006 5:28 AM in response to Damon

Public key authentication is on by default, what you want to do is disable password authentication. For that, you edit the file /etc/sshd_config. Change parameter "PasswordAuthentication" to "no" (and remove the hash sign at the start of the line). While you are there, you might want to override some less secure defaults, such as "Protocol 2" instead of "Protocol 2,1", and "PermitRootLogin no".

In order to use public key authentication you have to have, err, keys 😉 These you generate on your remote systems (using tools like ssh-keygen, depending of what implementation of ssh they use). This will give you public-private key pairs, one on each remote system. You can also generate a key pair that you carry around with you on a USB stick, and use from anywhere. Make sure you protect your private key with a (long!) passphrase.

Take the public keys (in OpenSSH they are called something like id_*.pub) and add them all into file ~/.ssh/authorized_keys on your local system, one key per line (beware of line breaks). That file must not have read or write permissions for anyone but the owner (yourself), or it won't be accepted by OpenSSH.

Before you make the above changes to /etc/sshd_config, test your key setup. If your keys are set up correctly, pubkey authentication will take precendence and you won't be prompted for a password upon login from remote. If you do get a password prompt something is wrong. You will get prompted for the passphrase protecting your private key on the remote system, of course.

Once your keys are working you can disable password authentication in the sshd config file.

Hope this helps.

Cheers
Steffen.

Sep 16, 2006 8:57 AM in response to Tim Haigh

Hi - thanks for that link. Outlines a very simple way to do all that ... my only remaining question though is:

When this is all setup (and regular password authentification will no longer work) would I always have to be on a machine that I had authenticated through these steps? Suppose I was traveling and on a friend's mac and needed to get my docs -- would I just use the passsphrase or does the passphrase also require the key?

Thanks! Damon

Sep 17, 2006 4:38 AM in response to Damon

The passphrase protects the private key (the secret part of the key pair - e.g. id_dsa or id_rsa). It is required whenever you want to use the private key.

You could carry a copy of the private key with you on a USB stick or similar. Be aware that if you lose it, the only thing that keeps someone from using your private key (your identity) is the passphrase, so choose a good one.

To use ssh from a remote machine with your key-on-a-stick type something like:

$ ssh -i /path/to/where/it/is/id_dsa you@yourhost

Cheers
Steffen.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How Safe is SSH ?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.