How to Change the SSH Port

Usefeul Technical Help and Info

How to Change the SSH Port

Postby Amos » Wed Dec 26, 2007 1:54 pm

Changing the port sshd listens on is simple.

Just update your sshd_config file and then reloading the new configuration.

Use the procedure below to change the port that sshd is listening on to 69:

1. From your terminal session, edit /etc/ssh/sshd_config

Code: Select all
[root@local]# vi /etc/ssh/sshd_config2


2. Look for the following line:

Code: Select all
#Port 22


3. Change the line so it looks like this:

Code: Select all
Port 69


4. Save and close the file

5. Load the new configuration by using the RedHat service command

Code: Select all
[root@local]# service sshd reload

Note: you may immediately lose connectivity to your server on the open ssh session you are currently running (I didn't lose connection, but i was not able to start a new one with the old port)

6. Test the connection

Code: Select all
[root@local]# ssh your.domain.com -p 69


Take note of the -p 69 flag used when connecting to the server. If you are using OS X or a Linux desktop system like Mandriva or Ubuntu, you'll need to specify the port number when connecting. If you're using PuTTy on Windows, you can specify the port number in the profile for you connection and then re-save the profile using the new port.
Don't Snooze

Amos
 
Posts: 134
Joined: Tue Apr 25, 2006 2:44 pm

Return to Technical Issues

Who is online

Users browsing this forum: No registered users and 1 guest

cron