How To SSH Using Different Port?

Discussion in 'HOWTO-Related Questions' started by matey, Oct 27, 2009.

  1. matey

    matey New Member

    I use the ssh --help but it is not clear as to how to use that -D switch in there?

    I want to use a different port than 22 since I think it's been blocked.
    I only get " Bad dynamic port " no matter which port I use even 22.

    The server is running our telephones (Asterisk) and has OpenBSD installed on it. Has NO display at the console?! (may be KVM switch box problem? but other servers work via the same sw box!) , I need to get into it to see what the problem is and re run the asterisk (extensions/sip reload) commands to register a phone set. But no go!
    got root too.
    any help will be appreciated, I mean the real help lol :D not the one that comes with the commands.
  2. damir

    damir New Member

    In terminal type:

    vi /etc/ssh/sshd_config
    Change from Port 22 to ex. Port 1011

    Save and restart ssh

    You should stay in the terminal window if you are changing Port so you don't locks your self out. Try to login in with new session to se if it works.
  3. matey

    matey New Member

    OK Thank you for your prompt reply!
    I'll try that later (I got to go now).

    I was at the server all this time and got the display back....

    But I really need to know how to re Enable ssh on/to this server.(I guess I open another thread)?

    because for instance the "asterisk -r" own command prompt has a very long help file which is very useful but it scrolls off the screen too quick and you cannot use |more /less whatever to stop and read it!
    cant pass it to a file either > ? it is their own shell i guess?

    With ssh I can use my own desktop (GUI) terminal to scroll up/down and read the help files plus do other things.

    Thank You!

    Best Regards;
    Last edited: Oct 27, 2009
  4. computer_freak_8

    computer_freak_8 New Member

    I don't think you want the -D option. Maybe the -d option, though. (The -D will not detach from the console; the -d will debug.)
    See this, too.

    I'm a bit confused by what you're trying to do. To enable SSH access on the remote machine, the program that needs to run is "sshd", not "ssh". To access the remote machine, for example, from your scrollable desktop GUI terminal, you'll need to use the program "ssh", following the syntax like:
    ssh -p 22 [email protected]
    You'll need to replace the "22" with whatever port you the server (sshd) is running on. The "username" needs to be the login name. The "@" symbol just tells the client (ssh) that the username you typed in should be used for accessing the IP address you typed in. In the example I gave, that IP address was "", so you'll need to replace it with whatever you need for your server.

    As for enabling the SSH daemon (sshd)/SSH server, try this page; it mentions:
    Hope this helps; let us know either way. Good luck!

Share This Page