Linux – How to: SSH private key authentication on OS X

authenticationlinuxssh

I need to ssh into a linux box. The server admin gave me a public and private ssh key. When I'm trying to login with the private key the login times out ("Operation timed out").

I'm using this command to login:

ssh -v -i /path/to/private_key host

What would be the right way to login? Do I need the public key for authentication?

Thanks for any help.

Update:

Output of the ssh command:

OpenSSH_5.2p1, OpenSSL 0.9.8l 5 Nov 2009
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to <domain> [<ip address>] port 22.

If I'm using telnet to connect it says:

Trying <ip address>...
telnet: connect to address <ip address>: Operation timed out
telnet: Unable to connect to remote host

Best Answer

First of all, the key pair should be generated by you. Your private key is yours, it doesn't belong to anyone else. You should generate the keys and give the public key to the server admin who would install it in the server.

Public key authentication is described in here.

On the other hand, the ssh command you're typing seems ok. What's the error output on your side? And on the server side?

What happens when you telnet that server on port 22?

telnet host 22

EDIT: Edited the answer after the feedback. It seems that the server doesn't have port 22 opened to your ip as the telnet timed out. Probably is closed in the firewall or something similar. Talk to the server admin and show him this debug :)