Ask Different is a question and answer site for power users of Apple hardware and software. 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 am trying to use SSH and log in from the terminal into a Linux VPS.

I have tried a few variations around the following:

ssh [user]@[hostname].[my.ip.address.xx]:22

and keep getting:

ssh: Could not resolve hostname [hostname].[ip address]:[port]: nodename nor servname provided, or not known

I have verified that my VPS works fine logging in from Windows with Putty, so I am sure I have something mixed up.

What is the format I should write this SSH command in?

share|improve this question
Is the VPS hosted? Or do you run the VPS yourself? – Graham Perrin Aug 2 '12 at 2:15
hosted, but answer below worked. I was trying to append the port, hostname, and username (since the error message suggest I needed to), but ssh [my ip] worked like a charm. – Morgan Herlocker Aug 2 '12 at 2:18
up vote 5 down vote accepted

Use a hostname, or IP address. Not both.

The hostname will only work if there is a resolvable DNS entry.
The IP address should always work as long as you use a publicly routed or otherwise reachable one.
You don't have to specify port 22, it is the assumed default when otherwise unspecified.

share|improve this answer
wow, do I feel like an idiot; aka thanks. (marking as answer in 8 minutes) – Morgan Herlocker Aug 2 '12 at 2:14

If you want to use both hostname and ip adress use -W argument to set the host (ssh ip -W host:port)

share|improve this answer

Your Answer


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

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