0

I am having an issue with the ssh daemon not starting on one of EC2 instances. I created another instance to access the volume, mounted the volume without any issues and tried many many solutions without any help. Seeing the instance log I see that "1;31mFAILED[0m] Failed to start OpenSSH server daemon. See 'systemctl status sshd.service' for details. " I accessed the volume logs from a second instance and I could see the following error: "/etc/ssh/sshd_config: Permission denied". I tried changing the permissions of the sshd_config files to 711, 755 and even 777 without any help. Changed the owner with chroot and without also didn't help.

Any suggestions are very welcomed

Thank you

1

So the problem seems to be caused by a modified sshd_config and broken selinux context. What I did is I temporarily disabled selinux by modifying /etc/selinux/config. I then managed to boot and fix the permissions problem as well as context of the ssh folder. I ran restorecon -v /etc/ssh/sshd_config then fixed the permissions of /etc/ssh to 700 and /etc/ssh/sshd_config to 600

0

It's a text file for storing ssh configurations, not an executable file, so should not set it 777

By default, permission is 0644 or just 644 and belongs to root:root

-rw-r--r-- 1 root root 1.7K Aug 21 03:14 ssh_config
-rw-r--r-- 1 root root 3.3K Dec 10 19:08 sshd_config
0

What are the permissions on your sshd_config? Compare it to the permissions on the new instance that you spun up. My newly created RedHat 7.0 instance has the following permissions (0600):

# ls -lah /etc/ssh/sshd_config
-rw-------. 1 root root 4.4K Mar 19  2014 /etc/ssh/sshd_config
  • Thank you for answering. Current permissions for the /etc/ssh folder are as follows: -rw-r--r--. 1 root root 581843 Apr 11 2018 moduli -rw-r--r--. 1 root root 2276 Apr 11 2018 ssh_config -rw-r--r-- 1 root root 3905 Feb 9 10:53 sshd_config -rw-r--r--. 1 root root 227 Jun 23 2018 ssh_host_ecdsa_key /etc/ssh is: drw-r--r--. 2 root root 225 Feb 9 12:12 ssh – Dirar Abu Kteish Feb 10 at 11:25
  • It's not obvious from the permissions on the file. Do you see any other errors that might be the reason for your issue? Is this a newly created instance? – relevantRope Feb 11 at 6:46
  • Not new instance and no other errors other than the ones I mentioned. I will try to install web terminal on the instance to access it without ssh – Dirar Abu Kteish Feb 11 at 7:01
  • thanks. let us know what you find. If it's not a new instance and it was working before, then obviously something went wrong somewhere. I think more digging in the logs might assist in finding the issue. And maybe a reinstallation of the ssh daemon could be beneficial – relevantRope Feb 11 at 7:23

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.