I'm trying to test my honeypot but for some reason I'm getting this message:

ssh root@server
ssh: Could not resolve hostname server: Name or service not known

What I'm doing wrong?

  • 1
    Add what command did you use for ssh.
    – Rahul
    Jan 21, 2017 at 23:47
  • 5
    the correct syntax for ssh would be this ssh [email protected]
    – WooJoo
    Jan 22, 2017 at 0:36
  • @WooJoo Looks like you have the answer ;)
    – Seth
    Jan 22, 2017 at 4:52
  • @WooJoo yes, that's the right answer , I can't believe I made such a simple mistake Jan 22, 2017 at 8:18
  • @WooJoo Post the answer ;)
    – pa4080
    Jan 22, 2017 at 8:26

4 Answers 4


To connect to an ssh server in a terminal you need:

  1. The call ssh to start the program
  2. The user name, which in your case is root
  3. An @ sign separating the user name from the server identification
  4. The IP address or name of the server, which in your case is

Assembled, the command looks like:

ssh [email protected]

in general terms, ssh user@server.

Alternatively, you can use the -l option to directly specify the login name and skip the @ syntax:

ssh -l root

As WooJoo stated, you need to tell it a valid server to connect to. If you wanted to use the form $ ssh root@server you can, but you would need to have server as an entry in /etc/hosts or your dns server (which is not the case or you would not have had an error), or an entry in a file called config located typically at /home/username/.ssh/config.

A sample /etc/hosts entry would look like:

# Sample /etc/hosts file    localhost    computerhostnamehere    server

and a sample /home/username/.ssh/config could be as simple as:

Host server
  User root

This would get you the basic functionality you are looking for. There are many more options available for placing in the ~/.ssh/config file.

See man ssh for more options :)


Please try by adding server entry to which you are trying to ssh in /etc/hosts file of machine from where you want to do ssh

    ssh-copy-id user@host && chmod 0755 /root (if root user) or chmod 0755 /home/username
  • 2
    This probably won't solve the problem because of DNS resolution failing.
    – Thomas Ward
    May 14, 2020 at 22:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .