SSHd Problems only on nonstandard port

Issues related to applications and software problems
Post Reply
hemlockz
Posts: 2
Joined: 2014/08/11 20:22:29

SSHd Problems only on nonstandard port

Post by hemlockz » 2014/08/11 21:51:46

Hi Guys, Hope you can help get me started in the right direction. I am setting up a VPS from CD-ROM source, and want to change my SSH default port by editing /etc/ssh/sshd_config. The default port works fine, and I can confirm that:

Code: Select all

$ sudo systemctl status sshd -l
sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled)
   Active: active (running) since Mon 2014-08-11 14:36:14 PDT; 3min 23s ago
  Process: 3642 ExecStartPre=/usr/sbin/sshd-keygen (code=exited, status=0/SUCCESS)
 Main PID: 3644 (sshd)
   CGroup: /system.slice/sshd.service
           ââ3644 /usr/sbin/sshd -D

Aug 11 14:36:14 localhost.localdomain systemd[1]: Stopping OpenSSH server daemon...
Aug 11 14:36:14 localhost.localdomain systemd[1]: Starting OpenSSH server daemon...
Aug 11 14:36:14 localhost.localdomain systemd[1]: Started OpenSSH server daemon.
Aug 11 14:36:14 localhost.localdomain sshd[3644]: Server listening on 0.0.0.0 port 22.
Aug 11 14:36:14 localhost.localdomain sshd[3644]: Server listening on :: port 22.
When I change the Port line in the config file to any number besides 22 by uncommenting the line and changing the number I get this

Code: Select all

Port 3000
$ sudo systemctl restart sshd.service
$ sudo systemctl status sshd -l
sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled)
   Active: activating (auto-restart) (Result: exit-code) since Mon 2014-08-11 14:40:58 PDT; 2s ago
  Process: 3667 ExecStart=/usr/sbin/sshd -D $OPTIONS (code=exited, status=255)
  Process: 3664 ExecStartPre=/usr/sbin/sshd-keygen (code=exited, status=0/SUCCESS)
 Main PID: 3667 (code=exited, status=255)

Aug 11 14:40:58 localhost.localdomain systemd[1]: sshd.service: main process exited, code=exited, status=255/n/a
Aug 11 14:40:58 localhost.localdomain systemd[1]: Unit sshd.service entered failed state.
Any suggestions? Thanks

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: SSHd Problems only on nonstandard port

Post by TrevorH » 2014/08/11 22:20:59

Sounds like it might be an selinux issue - did you use semanage to add a definition for the new port and assign it the same context as the current one?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

hemlockz
Posts: 2
Joined: 2014/08/11 20:22:29

Re: SSHd Problems only on nonstandard port

Post by hemlockz » 2014/08/12 23:10:15

Yeah! I didn't know I was using SElinux :roll: but your answer was correct. I tried the command semanage and it didn't exist in this base install so I thought for some reason that I wasn't using SELinux. I know that's wrong now and semange is not a dependency for SELinux or whatever I was thinking. I found semange in yum package policycoreutils-python using yum provides command that I read about from the FAQ on this forum after I posted this. Sorry and Thanks!

Post Reply