1

I've just set up Jessie on my RPi 1 Model B. It's connected via LAN cable to my network, it has an internet connection active and I can SSH to it. I'm able to ping both local machines and remote websites.

I have a Xubuntu virtual machine which is connected directly to my router and has a working OpenSSH server running (I can connect to it both inside my local network and from the internet with no problems at all).

What bothers me is that, when I try connecting to this machine from the RPi, it gives me an error "ssh: Could not resolve hostname 192.168.1.201:2222: Name or service not known".

As I said, I can easily connect to that host from any other device. As I said, I can ping that machine from the Raspberry.

Any idea?

EDIT:

ssh -vv output:

pi@raspberrypi:~ $ ssh -vv alessandro@192.168.1.201:2222
OpenSSH_6.7p1 Raspbian-5+deb8u2, OpenSSL 1.0.1k 8 Jan 2015
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
ssh: Could not resolve hostname 192.168.1.201:2222: Name or service not known

/etc/ssh/ssh_config:

# This is the ssh client system-wide configuration file.  See
# ssh_config(5) for more information.  This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

# Configuration data is parsed as follows:
#  1. command line options
#  2. user-specific file
#  3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Site-wide defaults for some commonly used options.  For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.

Host *
#   ForwardAgent no
#   ForwardX11 no
#   ForwardX11Trusted yes
#   RhostsRSAAuthentication no
#   RSAAuthentication yes
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   GSSAPIKeyExchange no
#   GSSAPITrustDNS no
#   BatchMode no
#   CheckHostIP yes
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/identity
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_dsa
#   Port 22
#   Protocol 2,1
#   Cipher 3des
#   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
#   MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com
#   RekeyLimit 1G 1h
    SendEnv LANG LC_*
    HashKnownHosts yes
    GSSAPIAuthentication yes
    GSSAPIDelegateCredentials no
  • 1
    Try connecting with ssh -vv and edit in the output above. – goldilocks May 29 '16 at 12:24
  • It looks like 22 was added twice. My wild guess is that you typed 22 and the command added a 22. – PaulF8080 May 29 '16 at 13:42
  • Added verbose info as suggested by @goldilocks. Also, 2222 is indeed the actual SSH port for that machine, had to change it from the default 22 at some point because of some conflict with a previously installed web server. It has always been 2222 since then and never had any problem with it (I have to specify it everytime, of course) – cycloptux May 29 '16 at 13:46
2

ssh -vv alessandro@192.168.1.201:2222

This is incorrect syntax, which in latter editions of ssh (Debian/Raspbian tends to lag substantially behind current upstream versions) seems to have been made more clear, where the output would probably have a third debug line:

resolving "192.168.1.201:2222" port 22

Notice it's the default port 22 being used. To specify an alternate port, use -p

ssh -p 2222 alessandro@192.168.1.201

Usage of ssh is explained in the man page, man ssh. Note that some SSH tools use -P instead of -p so if you are using, e.g., scp or sshfs check those pages.

  • Thank you very much, I might have been so used to Windows that I totally forgot the -p statement for ports. I'm feeling so dumb right now! – cycloptux May 29 '16 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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