PDA

View Full Version : How To SSH Using Different Port?


matey
27th October 2009, 12:47
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.

damir
27th October 2009, 13:04
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.

matey
27th October 2009, 14:29
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;

computer_freak_8
29th October 2009, 01:48
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?!
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 (http://www.openbsd.org/cgi-bin/man.cgi?query=sshd&sektion=8&arch=&apropos=0&manpath=OpenBSD+Current), too.

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.
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 username@192.168.0.7
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 "192.168.0.7", 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 (http://www.openbsd.org/cgi-bin/man.cgi?query=sshd&sektion=8&arch=&apropos=0&manpath=OpenBSD+Current) page; it mentions:
It is normally started at boot from /etc/rc.

Hope this helps; let us know either way. Good luck!