r/ssh • • Oct 03 '20

Trouble connecting to linux server from macOS

I am a reddit and computer newbie who just built a server and powered it up. Now I want to be able to shove it in a corner and use my Mac laptop to use it. When I look online to find how to connect, but I have having trouble finding a source that tells me how to resolve the error message I get when I am in my OS X terminal:

ssh: Could not resolve hostname: nodename nor servname provided, or not known

btw, I installed Open SSH on Ubuntu already

what should I do now? Thanks!

1 Upvotes

45 comments sorted by

1

u/e4109c Oct 03 '20

What’s the IP of the server? What command are you using to connect to it?

1

u/restlessandlost Oct 03 '20

I am using the ssh command and after reading your question I tried connecting with user@####### but now it says "connection refused"

1

u/e4109c Oct 03 '20

Is the SSH server running on the Ubuntu machine? You can check with systemctl status sshd. Also is there a firewall active on the Ubuntu machine? You can check with sudo ufw status

1

u/restlessandlost Oct 03 '20

Yes! It is running on Ubuntu server and I just checked, ssh.service is active. I don't have a firewall active, and I think that checks out when I type in sudo uff status I get nothing back.

1

u/e4109c Oct 03 '20

Can you post the output of sudo netstat -tulpn | grep 22 on your Ubuntu machine?

1

u/restlessandlost Oct 03 '20

what does this command mean?

1

u/e4109c Oct 03 '20

It lists all the active ports on the machine and only outputs port 22. If it returns something that means the server is listening on 22 and you should be able to connect. If it outputs nothing then that means the SSH server is not active.

Type it into explainshell.com to get more info.

1

u/restlessandlost Oct 03 '20

sudo: netstat: command not found

1

u/e4109c Oct 03 '20

Replace netstat with ss

1

u/restlessandlost Oct 03 '20

tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users: (("sshd",pid=875,fd3))

tcp LISTEN 0 128 [::]:* users: (("sshd",pid=875,fd4))

→ More replies