ssh to non-22 not working, edited sshd_config and restarted sshd
So according to at least three sites I've been to, all I should need to do is edit the one line in sshd_config to another port (29 in this case, which is unused) and restart sshd. I've set my router to port forward to 29 on my server. 22 works. 29 works when I ssh locally but not from another computer on the internal network or from outside. using Fedora 12. Help?? Tanx in advance.
|
what is the output? for
Quote:
|
Kirukan, grep output is:
tcp 0 0 0.0.0.0:9222 0.0.0.0:* LISTEN 1808/sshd tcp 0 0 :::9222 :::* LISTEN 1808/sshd What is the 1808 business? No clue here, never muddled in this before. Thanks for your help. |
The whole clue are there, instead of asking all you just refer either from manpage or web.
1808 is process id 9222 is port listening sshd. Be patient with forum members Dear Friend.. |
Hi,
Quote:
In your first post you mention sshd listens on port 29, it seems that is not the case. It listens on 9222. Hope this helps. |
Thanx, I did now change port from 9222 to 29 in config file, missed that. restarted sshd, failed to stop. going back to 9222. restarts ok but no ssh. Thanks for the quick replies, all...
|
Hi,
Quote:
If so (as root user): - Stop the sshd daemon, - Change the port/listenaddress, - Start sshd daemon. Can you post the output of the following command (as root user): egrep -i "listen|port" /etc/ssh/sshd_config Hope this helps. |
Druuna, you assume correctly, not fixed. I did what you said. Stopped daemon, changed port, started daemon. Here's what my file looks like:
#Port 22 Port 9222 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress :: I also want to ask you about your use of egrep as, though I'm not a noob, I'm not a fecking expert and had to google egrep. Was your use of a pipe in "listen|port" a logical OR? it seems to be because anything with either "listen" or "port" was returned. Any education on the use of egrep would be bonus. here is my output from egrep, though it's the same as my paste above: [root@Dysnomia ssh]# egrep -i "listen|port" /etc/ssh/sshd_config #Port 22 Port 9222 #ListenAddress 0.0.0.0 #ListenAddress :: Tanx! |
Hi,
Quote:
You mention that this is not fixed, what exactly do you mean by that? Assuming you want to use port 29 and changed the sshd_config file accordingly; Are you able to use ssh locally (I.e: ssh -p 29 localhost and ssh -p a.b.c.d and/or are you able to access this box from another box? If you can ssh locally it proves that the sshd daemon is listening and working. You can make sure by checking with this command: netstat -pln | grep ssh. If you cannot access this box from a remote box you might have a firewall in place that needs to be changed (it probably allows access to/from port 22, but not any other port). Quote:
Hope this helps. |
if your IPTABLES are up and running then you need to make it allow to connect to port 9222
|
Thanks all!
Thanks to everyone who gave assistance on this. It was COMPLETELY UNECESSARY however. I'm surprised no one asked "why are you doing this?" All i wanted to do is ssh to more than one box from the outside when all I need to do to accomplish this is remote into one and from there, remote to the other. No need for more than one port on firewall. >< Hey, at least I learned egrep, thanx!
|
Just to note, that you could also create a tunnel between the final machine and the local one, in case you want to copy something between these two without copying it first to the machine in the middle. The -L option to ssh will do it.
|
Thanks for tunnel suggestion
I didn't know that, Reuti, I'll research -L.
|
First you need to create the tunnel by logging in to the machine in the middle:
Code:
$ ssh -N -L 1234:final_machine:22 middle_machine Code:
$ ssh -p 1234 localhost |
All times are GMT -5. The time now is 04:11 PM. |