changing sshd port number

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

OS: Fedora 10
I'm trying to change the sshd port number but the instructions I used
didn't work:
1. Temporarily disabled iptables through the GUI.
2. Changed the variable Port from sshd_config to something other than
the usual.
3. Gave the command "service sshd restart".
4. Was then unable to remotely connect with ssh.
Then, I rebooted, restored the Port variable and enabled the firewall.

Is there some other instruction?  Is something else different? This
procedure worked
on RHEL 4. Would appreciate any suggestions.


Re: changing sshd port number

Quoted text here. Click to load it

How did you try to remotely connect with ssh?

And are you sure that your iptables really is disabled and that your
router does not block the port.
And what did you change Port to-- why not show us the exact line that
you have in your config.

Quoted text here. Click to load it

Re: changing sshd port number

Quoted text here. Click to load it

Hi pete,

Which GUI are you talking about? Afaik there is no 'THE GUI' for iptables.

$VARIABLE is the thing you have set

In /etc/ssh/sshd
#Port 22

run /etc/init.d/sshd_config restart
You will get a message if something is wrong.

First of all you should check if you can connect from the localhost.
Disable your firewall and try to connect to localhost

ssh $USER@localhost -p $NEWPORT

if that is not working you can check if the service is running through
as root
netstat -tulpe
then you should get something like this:
tcp 0 0 [::]:ssh [::]:* LISTEN root 21873 23179/sshd

If you have set up iptables:

iptables --insert -I INPUT -p tcp -d --destination-port

and delete the old rule
iptables --delete  -D INPUT $RULENUMBER

You should set up a script that sets your iptables correctly as the
settings are only temporary (after restarting your system they will be

Regards Friedrich

Re: changing sshd port number

I  was able to change the port and ssh to localhost using the new port
I had problems though with iptables. Running iptables -L lists no
rules.  But
running the FC-10 Firewall Configuration Tool has ssh checked.  Is
there a
procedure to change the firewall's sshd port using this Tool?  If so,
someone send the detailed instructions or list a website where they
already are.
I made a few attempts at using the tool but none of them allowed the
service to be changed.


Re: changing sshd port number

Quoted text here. Click to load it

You'll probably need to tell the firewall explicity what port the sshd
is now running on (it might pick up the port number from /etc/services
but I wouldn't count on it).

Make sure that sshd has started on the new port (netstat -nap)


Site Timeline