CahitEy
asked on
Change ssh port
How could i change ssh port of my linux cent os 5.4 final
ASKER
file is seems like the given below will i remove the -> #
then i will change it to another port and i will configure iptables before doing this is this right ?
then i will change it to another port and i will configure iptables before doing this is this right ?
#Port 22
#Protocol 2,1
Protocol 2
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 768
Remove # and change to anything like
Port 222
but change the iptables rules first. and restart iptables
-A RH-Firewall-1-INPUT -s xx.xx.xx.xxx -p tcp -m tcp --dport 222 -j ACCEPT
upper rules will allow only that ip to allow your ssh
Port 222
but change the iptables rules first. and restart iptables
-A RH-Firewall-1-INPUT -s xx.xx.xx.xxx -p tcp -m tcp --dport 222 -j ACCEPT
upper rules will allow only that ip to allow your ssh
ASKER
ok then how could i restart ssh service to activate new port
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You are a life saver :D
one last question for today if you have time
https://www.experts-exchange.com/questions/26022199/Apache-Vs-Litespeed.html?anchorAnswerId=31887500#a31887500
one last question for today if you have time
https://www.experts-exchange.com/questions/26022199/Apache-Vs-Litespeed.html?anchorAnswerId=31887500#a31887500
change the port
Port 22
to anything you like
then restart sshd damon
dont forget to add that port in iptables
also only allow certain ip to connect to the servier via iptables
dont allow it to every one. its a security risk