Newbie confusion: can't access ssh server on non-standard port
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
[Solved] Newbie confusion: can't access ssh server on non-standard port
I have ubuntu server 8.04 setup and running ssh. I initially setup ssh with the standard port 22 and it worked. I could access the server from work by forwarding port 22 on my wifi router to my server.
Then I wanted to change to a non-standard port to help minimize ssh attacks. So, I've tried ports 40, 8989, and 8988. I changed the port in sshd_config and changed the router to forward, for example, port 40 to my server. I then tried to ssh the server using port 40 and I get:
Network error: Connection timed out
I just don't understand why it worked with port 22, but not port 40.
Last edited by tennis_slacker; 01-28-2009 at 06:40 PM.
Reason: Marked title as Solved
I have ubuntu server 8.04 setup and running ssh. I initially setup ssh with the standard port 22 and it worked. I could access the server from work by forwarding port 22 on my wifi router to my server.
Then I wanted to change to a non-standard port to help minimize ssh attacks. So, I've tried ports 40, 8989, and 8988. I changed the port in sshd_config and changed the router to forward, for example, port 40 to my server. I then tried to ssh the server using port 40 and I get:
Network error: Connection timed out
I just don't understand why it worked with port 22, but not port 40.
This is just a shot in the dark, but did you restart the ssh daemon after you made the changes to the config file? The changes won't take effect until after you restart the daemon.
I've honestly never even used SSH before, but I didn't see any mention of restarting it, so it's worth a shot.
This is just a shot in the dark, but did you restart the ssh daemon after you made the changes to the config file? The changes won't take effect until after you restart the daemon.
I've honestly never even used SSH before, but I didn't see any mention of restarting it, so it's worth a shot.
Sorry, I should have mentioned this. Yes, I did restart the daemon. I had no trouble logging into the ssh server from ports 40, 8989, and 8988 when on my LAN. However, from the internet I get the time out error on those ports, but not with port 22. The standard ssh port. Each time I also changed the port forwarding in the router.
Sorry, I should have mentioned this. Yes, I did restart the daemon. I had no trouble logging into the ssh server from ports 40, 8989, and 8988 when on my LAN. However, from the internet I get the time out error on those ports, but not with port 22. The standard ssh port. Each time I also changed the port forwarding in the router.
Haha, so much for my guess. I just didn't see you mention it, so I thought I'd throw it out there. What kind of router do you have?
It's a Linksys WRT54GL running dd-wrt. I've setup my server with a static ip from the router and ubuntu and then I port forward to the server ip 192.168.1.100.
Is there a firewall?
If yes did you open the new port ?
Nothing on ubuntu server that I've setup. From what I've read ufw is disabled by default and I definitely haven't turned it on (yet). Once I get this ssh stuff figured out I was planning on turning it on and setting it up.
Here's the link to the ubuntu server firewall guide, stating that:
What's your SSH command line look like when you are trying to use a non-standard port?
I'm actually using putty from work. So, I just enter the WAN IP and the port. Like I said, it worked just fine with port 22, the other ports give me the connection time out error.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.