Adding ports for SSH
-
- A semi-regular
- Posts: 28
- https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
- Joined: Sat Apr 20, 2013 6:05 am
Adding ports for SSH
I wish to add ports for SSH to listen to, but unfortuantely I cannot get this working. I have tried adding the ports to SSH configs, tried various iptables rules, nothing is working. Is there an extra step I might be missing?
Re: Adding ports for SSH
It looks as though this is normally done with multiple Port lines in /etc/ssh/sshd_config (or your version of that file). For instance:
After making this change, you'd need to restart the SSH daemon (or the whole VDS).
Code: Select all
Port 22
Port 50
Port 99
Port 6666
Re: Adding ports for SSH
This was the first thing I tried changing. Unfortunately it didn't work. I have since tried adding a few rules to the iptables, which also did not work, and moments ago I tried restarting the whole VDS (I had already tried restarting SSH), but this has not changed things at all.Edge100x wrote:It looks as though this is normally done with multiple Port lines in /etc/ssh/sshd_config (or your version of that file). For instance:
After making this change, you'd need to restart the SSH daemon (or the whole VDS).Code: Select all
Port 22 Port 50 Port 99 Port 6666
Re: Adding ports for SSH
Have you tried disabling your firewall entirely? Have you checked the output of "netstat -anp" to see if it's listening on the ports locally?
Re: Adding ports for SSH
I tried using netstat -anp |grep ssh (or something similar) and it seems like the ports are opened locally. And I think you have suggested disabling the firewall in another thread, and to be honest it just doesn't feel right, you know what I mean? I'm pretty sure I've written the firewall rules correctly anyway; they work for port 22 and my rules are quite literally the exact same thing but on different ports.
Re: Adding ports for SSH
Temporarily disabling the firewall is a troubleshooting step. If disabling the firewall eliminates the problem, you'll know that you need to adjust it. If I suggested that you do this previously, and you chose not to, then you could have potentially avoided this entire thread and the wasted time it entailed by following my advice.
If the ports are open locally, on the correct IP(s), then it's a firewall issue.
If the ports are open locally, on the correct IP(s), then it's a firewall issue.
Re: Adding ports for SSH
I've already tried that, I thought you offered that as a solution rather than a diagnostic. It doesn't help regardless.Edge100x wrote:Temporarily disabling the firewall is a troubleshooting step. If disabling the firewall eliminates the problem, you'll know that you need to adjust it. If I suggested that you do this previously, and you chose not to, then you could have potentially avoided this entire thread and the wasted time it entailed by following my advice.
If the ports are open locally, on the correct IP(s), then it's a firewall issue.
Re: Adding ports for SSH
Please post the netstat output.
Re: Adding ports for SSH
# netstat -anp | grep ssh
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1380/sshd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1380/sshd
tcp 0 0 0.0.0.0:2021 0.0.0.0:* LISTEN 1380/sshd
tcp 0 52 74.91.112.155:22 153.107.40.9:61335 ESTABLISHED 1933/sshd
tcp 0 0 :::80 :::* LISTEN 1380/sshd
tcp 0 0 :::22 :::* LISTEN 1380/sshd
tcp 0 0 :::2021 :::* LISTEN 1380/sshd
unix 3 [ ] STREAM CONNECTED 14277 1933/sshd
unix 3 [ ] STREAM CONNECTED 14276 1935/sshd
unix 2 [ ] DGRAM 14273 1935/sshd
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1380/sshd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1380/sshd
tcp 0 0 0.0.0.0:2021 0.0.0.0:* LISTEN 1380/sshd
tcp 0 52 74.91.112.155:22 153.107.40.9:61335 ESTABLISHED 1933/sshd
tcp 0 0 :::80 :::* LISTEN 1380/sshd
tcp 0 0 :::22 :::* LISTEN 1380/sshd
tcp 0 0 :::2021 :::* LISTEN 1380/sshd
unix 3 [ ] STREAM CONNECTED 14277 1933/sshd
unix 3 [ ] STREAM CONNECTED 14276 1935/sshd
unix 2 [ ] DGRAM 14273 1935/sshd
Re: Adding ports for SSH
When you use "ssh localhost:80", does that work?
What method did you use to try to disable the firewall?
What method did you use to try to disable the firewall?
Re: Adding ports for SSH
This is what I get when I write that SSH command.
ssh: Could not resolve hostname localhost:80: Name or service not known
As for the firewall, I used service iptables stop
ssh: Could not resolve hostname localhost:80: Name or service not known
As for the firewall, I used service iptables stop
Re: Adding ports for SSH
Try ssh localhost -p 80, instead -- I made a mistake on the command.
For iptables, try "iptables --flush".
For iptables, try "iptables --flush".
Re: Adding ports for SSH
Using the new SSH command, the server tried to connect to itself in typical SSH fashion (asked for a host key, etc), so I assume that means it's working locally.
Doing iptables --flush has achieved nothing however.
Doing iptables --flush has achieved nothing however.
Re: Adding ports for SSH
I'm not sure what else it could be apart from a firewall problem.
Is your Firewall page in the control panel blank?
Do you have SELinux running?
Is your Firewall page in the control panel blank?
Do you have SELinux running?
Re: Adding ports for SSH
tried disabling and reenabling iptables, no luck.Edge100x wrote:I'm not sure what else it could be apart from a firewall problem.
Is your Firewall page in the control panel blank?
Do you have SELinux running?
Firewall page is blank.
No I do not have SELinux running.
This is becoming a tad frustrating; I really need to be able to access the server on these ports.