Can you change how ubuntu references changed ports?

I'm using Ubuntu 10.04 and wanted to know if you could change how the system references ports once they've been changed elsewhere.

One common example is ssh:

Irregardless of whether it is more secure to change the port from 22 to another number in /etc/ssh/sshd_config.

Once this is done, it seems other programs still reference ssh as running under port 22. For example "ufw allow ssh" opens port 22, not the new port.

Any config files that include "port: ssh" don't seem to work unless I manually edit them to the new number.

Is there a method to let the system and all other installed programs, config files, etc. know that a port has been permanently changed and to use the new number instead?

Thanks in advance.

5 Replies

I imagine quite a lot of software will always assume SSH is port 22 instead of following /etc/services, though…

Thanks, that seems to have done it.

@mnordhoff:

I imagine quite a lot of software will always assume SSH is port 22 instead of following /etc/services, though…

I doubt it. That would mean I would have to include some sort of list of port names and their numeric mapping with my software, instead of just calling getservbyname() and letting a system library do the work for me.

@piglet:

I doubt it. That would mean I would have to include some sort of list of port names and their numeric mapping with my software, instead of just calling getservbyname() and letting a system library do the work for me.

I was thinking more along the lines of software that uses SSH, not something that would need a general list of ports. OTOH, such software probably just calls out to /usr/bin/ssh itself. Shrug.

Edit: Thinking about it again, SSH client software isn't very relevant to this discussion anyway. Never mind.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct