0

I am having problems to connect a Linose server via SSH from my ubuntu console. I can connect from other PC's to the same server.

When I run:

$ sudo apt-get install openssh-server
ssh stop/waiting
sudo apt-get install openssh-server

Everything seem to be good, but

$ sudo service sshd
sshd: unrecognized service

And when I try to connect my server:

ssh root@xx.xx.xx.xx

I get timed out message.

I have tried uninstall and reinstall, but I am getting the same message. I also tried:

$ ssh localhost

And everything works fine.

EDIT Results for ssh -vvv root@xx.xx.xx.xx

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 45.33.12.79 [45.33.12.79] port 22.

UPDATE I ran:

$ sudo lsof -i | grep ssh
sshd      12020    root    3u  IPv4 125114      0t0  TCP *:ssh (LISTEN)
sshd      12020    root    4u  IPv6 125116      0t0  TCP *:ssh (LISTEN)

And:

$ netstat -l --numeric-ports | grep 22
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp6       0      0 :::22                   :::*                    LISTEN

UPDATE 2

$ sudo gedit /etc/ssh/sshd_config

...
# What ports, IPs and protocols we listen for
Port 22
...
# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes
...

UPDATE 3

$ sudo ufw status verbose
Status: Inactive
4
  • Where did you try to install the openssh-server? On your local machine or on the server? – P.-H. Lin Aug 25 '15 at 3:14
  • @P.-H.Lin On my local machine. As I said, I can connect to the server via SSH from other PC's, I am having problems only from my PC – Gocht Aug 25 '15 at 3:16
  • Post results of 'ssh -vvv root@whatever' – wlraider70 Aug 25 '15 at 3:18
  • @wlraider70 updated. – Gocht Aug 25 '15 at 3:21
0

this seems to me like a problem with permission on folder (and files recursive) /home/user/.ssh/

You want this folder (.ssh) and all files underneath , to be protected from anyone (except you of course). So change the permission in this folder (and to all files underneath) with chmod command .

Sudo chmod 600 ~./ssh

The number is a permission setting, I think 600 will solve the problem, which I believe stems from too permissive of a file.

above command will remove the Read , Write and Execute permission from Everyone , except the owner of the folder (and files inside it) which in this case is You.

3
  • On my local machine? I did it but still getting timed out message. – Gocht Aug 25 '15 at 3:29
  • On the machine connecting. the client not the server – wlraider70 Aug 25 '15 at 3:31
  • I did. I didn't work. – Gocht Aug 25 '15 at 3:34
0
  1. I don't think this flavor uses the daemon end part. I think your service name is ssh-service. I may be wrong on that though.

  2. Your firewall may be filtering out port 22.

Do a port scan on your machine and check to see if 22 is open.

Edit

Okay - now - check your SSH config is listening on 22. I still think that it's not sshd, it's something else. Service ssh status or something of the sort. Haven't worked on that flavor in a long time.

Next - do you have a firewall in between? Try turning off iptables if you have it on. Fail2ban? These all can cause problems. Go into ash config and ensure password authentication is on if you are just trying to connect without any certificates or real security.

Edit again

I would say that there is some type of firewall rule or corrupt IPtable rule on your host box then if others can connect to the server. I have seen this more times than you can believe. Run a flush on iptables on the host. (Can you even ping the server machine?)

That's the old viable reason at this point since ssh localhost works.

Edit again again

Iptables isn't a service.

http://www.cyberciti.biz/tips/linux-iptables-how-to-flush-all-rules.html

8
  • Thanks for your answer, I updated, can you check results, please? – Gocht Aug 25 '15 at 3:28
  • Updated, i will uncomment the last line. --> Didn't work – Gocht Aug 25 '15 at 3:36
  • I can ping the server's IP, I when I run service iptables stop I get iptables: unrecognized service – Gocht Aug 25 '15 at 3:47
  • Iptables isn't a service. cyberciti.biz/tips/linux-iptables-how-to-flush-all-rules.html – Gordon Snappleweed Aug 25 '15 at 3:48
  • Done, the same problem... – Gocht Aug 25 '15 at 3:52

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.