Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


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
share|improve this question

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 :)

share|improve this answer
Hi Marco, thanks for your reply. I've updated my question with the answers to yours. – dan May 19 '10 at 17:13
Updated my answer as well :) – Marco Ramos May 19 '10 at 17:14
I don't have access to the server, so I can't tell whats going on on the server side. Is there any way to tell the ssh command to use the provided public key? – dan May 19 '10 at 17:17
just talk to the server admin and say him that you haven't connectivity to the ssh port and show him the output of the above commands :) – Marco Ramos May 19 '10 at 17:28
I will try that. Thank you very much. – dan May 19 '10 at 17:31

do you have anything blocking traffic on port 22 from your host? any firewalls or network devices that might restrict traffic except for certain ports?

the server administrator should be able to tell you which port, if not 22, that ssh is running on, and perhaps should have told you what you would need to do to connect, when setting this up with you. bad sysadmin.

generating your own public/private keypair would be a good idea, if you wanted to send the sysadmin your new public key, you can do something like this:

ssh-keygen -b 2048 -t rsa

that will prompt you what to call the key, ~/.ssh/id_rsa should be fine. you'll then want to send ~/.ssh/ to the server administrator, so he can "install" your public key.

also, if your username on the server is different from your local username, you may want to log in with:

ssh -i /path/to/privatekey user@host

where user is your username on the server, and -i /path/to/privatekey specifies your private key to use, if it is not one of the 'default' private key file names (~/.ssh/id_rsa is a default name/path, ssh will know where to look for that)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.