SSHD will not stay running

marchopkins
marchopkins used Ask the Experts™
on
Using Linux ES 6  Unable to get SSHD to stay started.      Using        service sshd start     or   restart   starts it but it goes right back to being stopped.

any thoughts?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software Developer / Linux System Administrator / Managing Director
Commented:
What do you see in your system logs? What is shown in /var/log/secure immediately after it fails? You could try
cat /var/log/secure | grep sshd

Open in new window

It may give you a clue as to why it is failing. Possibly there is a configuration issue.

Don't post any logs publicly unless you sanitise them first (remove IP addresses, user names etc).

Author

Commented:
Ill give this a go and let you know...thanks
David FavorFractional CTO
Distinguished Expert 2018

Commented:
Diagnostics may live in /var/log/messages or /var/log/secure or somewhere else.

Easy test.

service sshd restart
/bin/ls -lrt /var/log/*

Open in new window


Which will show your the most recently changed files last.

Then look for the sshd failure message + fix whatever problem is reported.

If your starting a new project, start with Ubuntu Bionic instead of ES X, as all the ES images contain outdated Kernels.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Got it..I found the issue...I was recently re-IPing the device and found that the ssh IP need to be changed as well.

SSHD is up and running....The only problem i have now is IP tables.   with them running, i cannot SSH to it...with them stopped...no problems.  I'll close this question as you were perfect with the answer.  If you have thoughts on the IPtables...i could use some help there too.

Author

Commented:
thanks to both of you...the first solution led me to the fix...thanks.
Martyn SpencerSoftware Developer / Linux System Administrator / Managing Director

Commented:
Great to hear that you fixed it. What rules do you have in iptables for port 22?

Author

Commented:
4    DROP       tcp  --  0.0.0.0/0            63.XXX.XXX.0/24     tcp dpt:22
5    ACCEPT     tcp  --  0.0.0.0/0            10.0.0.0/24         state NEW tcp dpt:22


are the only two Port 22 entries I have.
Martyn SpencerSoftware Developer / Linux System Administrator / Managing Director

Commented:
I am going to respond to this question, which I presume is related.
David FavorFractional CTO
Distinguished Expert 2018

Commented:
Tip: In your /etc/ssh/sshd_config file (or where ever this file is located on your Distro), remove the hard coded IP + use 0.0.0.0 so when you migrate your config, your config will work on any machine.

So use...

ListenAddress ::
ListenAddress 0.0.0.0

Open in new window


Or just take the default + leave these commented out, so sshd listens on all interfaces.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial