How to change ssh port *remotely*
0. yum -y install telnet-server
Enable telnet under xinetd by editing /etc/xinet.d/telnet (from disable=yes to no)
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
disable = no
}
1. Create a new account telnet123
Grant sudo or something to telnet123
2. Telnet to the server
3. Change sshd port from 22 to 2200
[root@dragon525 ~]# diff /etc/ssh/sshd_config*
13,14d12
<
< # Stanrdard port
16,19d13
<
< # vuhung 2011/08/10 ported changed to 2200
< Port 2200
<
4. Restart sshd: sudo /etc/init.d/sshd restart
5. Login with ssh, new port = 2200
6. Delete user: telnet123
7. Delete package telnet-server or disable telnet (see step 0), using ssh.
No comments:
Post a Comment