Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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
add comment

2 Answers

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
add comment

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
add comment

Your Answer

 
discard

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.