I cannot access ssh after configuration of cloudflare DNS

2

I cannot access my digital ocean server via ssh after configuration of CloudFlare DNS.

When trying to access the server using the command: ssh root@x.x.x.x, I get the error:

$ ssh -v root@x.x.x.x

OpenSSH_6.6.1, OpenSSL 1.0.1i 6 Aug 2014

debug1: Connecting to x.x.x.x [x.x.x.x] port 22.

debug1: connect to address x.x.x.x port 22: Attempt to connect timed out without establishing a connection

ssh: connect to host x.x.x.x port 22: Bad file number

where x.x.x.x is my original IP address given from digitalocean.com. I am sure ssh is enabled and running There is no entries in /var/log/logauth.log I am using Ubuntu 12 The Digitalocean firewall is allowing input traffic on port 22.

What should I do to overcome this issue?

Jaime Alvarez

Posted 2017-09-22T15:13:49.847

Reputation: 21

Can you ping it? What says traceroute ${your server IP} – xenoid – 2017-09-22T15:35:37.100

Yes I can ping. And I can access the server via web-console, but when I use a ssh client it gives me the Bad file number error. – Jaime Alvarez – 2017-09-22T15:58:15.437

I realized that after running the command: "service ssh status" tell me that the process is running but after executing the command "netstat -napt" tells me that the ssh is not running, only I can see the ports 21,25,3306 and 80 opened. It seems the ssh is not running. How to fix it? – Jaime Alvarez – 2017-09-22T16:33:02.093

Do you have any DigitalOcean web interface that will allow you to restart your server? If not then you'll probably need one of their support staff to restart it for you... – Kinnectus – 2017-09-22T16:39:57.273

Yes! I have restarted my server, but the issue continues. – Jaime Alvarez – 2017-09-22T16:59:04.050

I have changed the port to 25000 to but the problem persists. I think the problem is that ssh doesn't start successfully and the log doesn't have anything about it. (/var/log/auth.log) – Jaime Alvarez – 2017-09-22T17:01:32.927

Is it normal to have something on port 21 (FTP)? – xenoid – 2017-09-22T19:55:22.523

Answers

0

I have fixed the problem using the digital ocean web console and reinstalling the OpenSSH server:

apt-get remove --purge openssh-server && sudo apt-get install openssh-server

I had to change some ssh setttings in /etc/ssh/sshd_config

PermitRootLogin yes

Then you can setup the SSH Keys and finish the server configuration:

https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2

Jaime Alvarez

Posted 2017-09-22T15:13:49.847

Reputation: 21