LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-27-2009, 02:43 PM   #1
tennis_slacker
Member
 
Registered: Apr 2008
Location: Idaho
Distribution: Slackware
Posts: 92

Rep: Reputation: 17
[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
 
Old 01-27-2009, 03:15 PM   #2
MaizeNBlue2
LQ Newbie
 
Registered: May 2006
Location: Indiana, USA
Distribution: Slackware 12.2
Posts: 23

Rep: Reputation: 15
Quote:
Originally Posted by tennis_slacker View Post
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.
 
Old 01-27-2009, 03:33 PM   #3
tennis_slacker
Member
 
Registered: Apr 2008
Location: Idaho
Distribution: Slackware
Posts: 92

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by j_houch View Post
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.
 
Old 01-27-2009, 03:40 PM   #4
MaizeNBlue2
LQ Newbie
 
Registered: May 2006
Location: Indiana, USA
Distribution: Slackware 12.2
Posts: 23

Rep: Reputation: 15
Quote:
Originally Posted by tennis_slacker View Post
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?
 
Old 01-27-2009, 03:44 PM   #5
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Is there a firewall?
If yes did you open the new port ?
 
Old 01-27-2009, 03:48 PM   #6
tennis_slacker
Member
 
Registered: Apr 2008
Location: Idaho
Distribution: Slackware
Posts: 92

Original Poster
Rep: Reputation: 17
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.
 
Old 01-27-2009, 03:51 PM   #7
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Quote:
port forward to the server ip 192.168.1.100.
firewall on the server?
 
Old 01-27-2009, 03:53 PM   #8
tennis_slacker
Member
 
Registered: Apr 2008
Location: Idaho
Distribution: Slackware
Posts: 92

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by repo View Post
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:

ufw by default is initially disabled
https://help.ubuntu.com/8.04/serverg.../firewall.html

Last edited by tennis_slacker; 01-27-2009 at 04:00 PM. Reason: added link confirming default ubuntu firewall setup
 
Old 01-27-2009, 03:59 PM   #9
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
what is the output from
iptables -L
on the server?
 
Old 01-27-2009, 04:01 PM   #10
tennis_slacker
Member
 
Registered: Apr 2008
Location: Idaho
Distribution: Slackware
Posts: 92

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by repo View Post
what is the output from
iptables -L
on the server?
Will be home in about an hour and I'll report.
 
Old 01-27-2009, 04:07 PM   #11
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Also try to use a higher port
2200 or 2222
 
Old 01-27-2009, 04:12 PM   #12
tennis_slacker
Member
 
Registered: Apr 2008
Location: Idaho
Distribution: Slackware
Posts: 92

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by repo View Post
Also try to use a higher port
2200 or 2222
I tried 8989 and 8988, hidden in my first post . Should that work?
 
Old 01-27-2009, 04:13 PM   #13
pentode
Member
 
Registered: Dec 2005
Location: Oregon
Distribution: Debian Testing
Posts: 488

Rep: Reputation: 38
What's your SSH command line look like when you are trying to use a non-standard port?
 
Old 01-27-2009, 04:16 PM   #14
tennis_slacker
Member
 
Registered: Apr 2008
Location: Idaho
Distribution: Slackware
Posts: 92

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by pentode View Post
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.
 
Old 01-27-2009, 05:35 PM   #15
tennis_slacker
Member
 
Registered: Apr 2008
Location: Idaho
Distribution: Slackware
Posts: 92

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by repo View Post
what is the output from
iptables -L
on the server?
bob@server:~$ sudo iptables -L
[sudo] password for bob:
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
bob@server:~$
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using DSL and ssh / ssh-server to access the Windoze desktop GUI On2ndThought Linux - Server 4 11-16-2008 02:17 PM
Howto do Secured ssh from port https or port80(standard) to ssh d listening port 22 ? Xeratul Linux - General 4 11-23-2006 06:09 AM
Can I run a server on a non-standard port, from shell or web host account? phugoid Linux - Networking 4 03-09-2006 10:33 AM
Using an USB port as a standard DB9 Serial Port Lsteele Linux - Newbie 1 10-22-2005 09:48 AM
Unable to access my ssh server and ftp server from the Internet, but smtp works foxone Linux - Networking 1 05-28-2004 05:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration