I need to listen to SSH on two ports: 22 for hosting admin access and 26 for regular access. I would like to disallow root login on 26 and disallow all but internal IPs for port 22. The latter can be done with iptables rules, but I don't know about the former. Any ideas?
|
Assuming sshd will run with a command-line specific config file, then you could create a second config that runs on port 26 and execute a second start-up script that refers to that port. |
|||
|
|
|
You can use the Port 26 directive to change the port that the sshd is listening on. set PermitRootLogin no to disable root logins You can then do something like
You may want to copy the standard sshd startup script and modify them so that you can start the port 26 service at startup. Why are you doing this ? |
||||
|
|
|
In
Save the file and restart the sshd daemon. I do this in situations where I have ssh enabled for internal users on port 22, but require external connectivity on say, port 2222. This binds the ssh daemon to both port numbers. |
||||
|
This article might be helpful: http://everythingsysadmin.com/2010/09/the-most-simple-ssh-backdoor-i.html |
|||
|
|

suor better yetsudo. – Chris S♦ Jun 27 '11 at 17:14PermitRootLoginparameter towithout-password. This only allows root login via ssh to occur with an ssh key. Password authentication will not work. – ewwhite Jun 27 '11 at 17:29