So, I am setting up an ssh server. I have installed the ssh-server program on my server. However, I didn't want to connect to it through port 22, because reasons, so I set the server to listen through another port (2584). How do i set up my client to also connect through port 2584 rather than port 22?
Asked
Active
Viewed 3.4k times
4
-
2You can setup `~/.ssh/config` file to simplify your ssh terminal commands, here is a complete manual: [How To Configure Custom Connection Options for your SSH Client](https://www.digitalocean.com/community/tutorials/how-to-configure-custom-connection-options-for-your-ssh-client). Also in [this answer](https://askubuntu.com/a/986245/566421) of mine is presented an example. – pa4080 Jan 16 '19 at 16:39
2 Answers
11
Assuming you are using normal ssh command it is the additional parameter -p (see the man page of man ssh). E.g:
$ ssh -p 2584 user@host
Christian Wolf
- 315
- 3
- 10
2
Note that ssh accepts commands in the URI form, such as ssh://[email protected]:<port>. It is perfectly valid to do the following:
ssh ssh://myuser@domain_name.com:2222
Alternatively, to avoid specifying port each time, you can declare it within ~/.ssh/config. See steeldriver's answer for details.
Sergiy Kolodyazhnyy
- 103,293
- 19
- 273
- 492