Help - Search - Members - Calendar
Full Version: how to cahnge the ssh port?
The Planet Forums > Control Panels > cPanel/WHM > Cpanel/WHM HOWTOs
Lim
I found the Logwatch show that somebody trying to access my server thru ssh.
May I know how can I protect myself? How about chang the ssh prot? does it able to help? anybody can teach me how to cahnge the ssh port?
Quiddity
You can change the port sshd operates on by modifying the Port value in /etc/ssh/sshd_config. If you're not familiar with how to do this, the following commands should be of help:

cp /etc/ssh/sshd_config /etc/ssh/sshd_config.backup
sed -r 's/Port ([0-9]+)/Port CHANGEME/' /etc/ssh/sshd_config > /etc/ssh/sshd_config.new
mv /etc/ssh/sshd_config.new /etc/ssh/sshd_config
service sshd restart

Where CHANGEME should be the new port you wish for sshd to operate on.

- Steve
Lim
Thank you. I am going to try.
ramprage
Before you do this make sure your firewall has the new port open otherwise you'll be locked out!
kwiznoz
Is there a recommended port number to change this to?
pcsmith_uk
QUOTE (kwiznoz)
Is there a recommended port number to change this to?

erm, no, if there was they'd all know about it :confused:
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.