1820636 Members
1851 Online
109626 Solutions
New Discussion юеВ

SSH Port Number

 
Tim King_3
Advisor

SSH Port Number

Hi, I would like to change my ssh port number to deter scans. I tried changing the port number in the sshd_config file, stopping and starting sshd but it is still listening on port 22. Are there other changes needed?

Thanks
Tim
6 REPLIES 6
Pat Lieberg
Valued Contributor

Re: SSH Port Number

I thought that would be all that would be needed as well.

Is there an entry in /etc/services? I don't think one is added by default with HP SecureShell, but you could double check.
Tim King_3
Advisor

Re: SSH Port Number

There is not. I think I got it though, I killed the sshd process and re started with:

/opt/ssh/src/sshd -p new_port_number.

Won't survive a reboot.
Pat Lieberg
Valued Contributor

Re: SSH Port Number

You could edit /etc/rc.config.d/sshd and the -p paramter to the SSHD_ARGS line.

That would survive a reboot.
Emil Velez
Honored Contributor

Re: SSH Port Number

make sure you uncommented the line in the sshd_config file. I made a error like that before.
RAC_1
Honored Contributor

Re: SSH Port Number

Better to start sshd through inetd. you will have to use -i option to start it through inetd. then you can set it to use any port you want.-/etc/services
There is no substitute to HARDWORK
Jim Keeble
Trusted Contributor

Re: SSH Port Number

The config file worked for me. I am using SSH version 4.0 from www.hp.com/go/software:

# /sbin/init.d/secsh stop
HP-UX Secure Shell stopped

# /sbin/init.d/secsh start
HP-UX Secure Shell started

# grep Port /etc/opt/ssh/sshd_config
Port 222
#GatewayPorts no

# netstat -an |grep 22
tcp 0 0 15.17.187.246.50740 15.228.73.117.6001 ESTABLISHED
tcp 0 0 15.17.187.246.512 15.228.73.117.1023 CLOSE_WAIT
tcp 0 0 *.222 *.* LISTEN
udp 0 0 *.1022 *.*
#