-2

what is the command to run ssh on port 1337 or alternate port?

4 Answers 4

5

sshd with -p PORT:

-p port Specifies the port on which the server listens for connections (default 22). Multiple port options are permitted. Ports specified in the configuration file with the Port option are ignored when a command-line port is specified. Ports specified using the ListenAddress option override commandline ports.

You can edit sshd config(/etc/ssh/sshd_config):

Port 1337
2

You want the Port directive in the sshd_config file, or alternatively sshd -p.
See man sshd & man sshd_config for more information.

0

You should read man sshd or man sshd.conf it is quite clear.

3
  • isn't there a command i can run per each instance of ssh?
    – Zach Smith
    Jan 31, 2011 at 18:45
  • No because you'd have to connect first then change port
    – Jacob
    Jan 31, 2011 at 18:48
  • ssh -p 2222 www.mywebsite.com
    – Zach Smith
    Jan 31, 2011 at 19:12
0

Just change the (possibly commented, in which case you obviously need to uncomment it) "Port 22" line in your ssh server configuration file to "Port 1337".

3
  • i only have one client that uses port 1337, other use regular port so i would rather just use the command line to connect that port each time
    – Zach Smith
    Jan 31, 2011 at 18:48
  • ssh -p 2222 www.mywebsite.com
    – Zach Smith
    Jan 31, 2011 at 18:54
  • Do you want to connect to an ssh server running on port 1337, or do you want to run a server on that particular port? You comment seems to indicate the former while the original question seems to indicate the latter.
    – user68055
    Jan 31, 2011 at 19:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .