Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
For some reason I cannot connect to my SSH box from outside my network. I've got tun0 and eth0 as my interfaces. 192.168.0.184 is the SSH box. I have port forwarding from 22 to go to 192.168.0.184. Also attached is my sshd. I don't use passwords to log in, only keys, but I don't think it's even getting that far. I can log in fine inside my network.
Code:
ssh: connect to host <IP> port 22: Connection timed out
# Package generated configuration file
# See the sshd_config(5) manpage for details
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768
# Logging
SyslogFacility AUTH
LogLevel INFO
# Authentication:
LoginGraceTime 120
PermitRootLogin no
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile %h/.ssh/authorized_keys
# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no
# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no
# Change to no to disable tunnelled clear text passwords
PasswordAuthentication no
# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#MaxStartups 10:30:60
#Banner /etc/issue.net
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
Hmm, ok, that's not it. Sorry I am running out of ideas. If it was me who had the problem I'd probably try and see if I can make another service visible from outside the network, such as e.g. a webserver over port 80. But I am sure there are smarter ways to proceed...
One thing that might be helpful to others for diagnosing the problem is the spec of the router and the configuration of it you are using...
Test #1: Add the -v option to your ssh attempt and determine where the timeout is happening. Before or after you connect to the target box?
Test #2: Try killing your sshd daemon on the box you're trying to login to, and see if your message changes to "Connection refused" rather than "Connection timed out". Of course, you should only kill sshd if no other user is using SSH and you have another method (physical access?) to get to the box to restart sshd after the test.
Look at your target servers logfile to see if a connection attempt was noted. My logfile is in /var/log/auth.log but yours may be in a different place. You will need to be root to view this logfile.
ssh -vv user@ip
OpenSSH_6.0p1 Debian-3, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /home/user/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to IP port 22.
debug1: connect to address IP port 22: Connection timed out
ssh: connect to host IP port 22: Connection timed out
There's nothing in any logs that I can see that relate to this. It looks like it gets to the route and the information is 'lost' between the router and the box. It's a Sky SR101 Router.
It seems that your router has all incoming ports closed by default. There are some further links in the thread (which I haven't reviewed) but you may want to take a look at that...
Edit: On second view it seems this is applying to another sky router, I would still check it out for yours as well.
I have port forwarding set up on it and set it to always log, and I believe that it is working as you can see in my router logs it sees when I try and connect it gives:
Sorry, I think this was a wrong trace. Obviously all incoming ports are closed by default on every router, it just looked to me as if this particular router had another layer of security / firewall on top, which needed to be customised. But I think that was a misinterpretation on my side.
Rebooted the box, everything works fine, start the VPN and now it stops responding.
Looks like it is to do with the VPN.
Huh? VPN? This is something you haven't mentioned before. You may want to provide some more information on your network setup/layout to get useful help...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.