LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 06-15-2012, 04:14 AM   #1
nOrVow
LQ Newbie
 
Registered: Jun 2012
Posts: 4

Rep: Reputation: Disabled
problem with ssh/putty. Error: "connection timed out"


I'm trying to ssh from my windows machine using putty into a Linux VM for my certification studies. This is password based authentication, so i'm not using any pub/private keys. Not entirely concerned about that right - I just want things to work first then i'll get to that.

I'm running a relatively new install of mint, and the sshd daemon already up and running. I'm able to ssh to the guest localhost within the VM, but I can't ssh into the VM externally from host (windows). I disabled ufw to see if that would be the culprit but the problem persists.

here's my sshd_config file.

Quote:
# 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 0.0.0.0
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 yes
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 yes

# 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
Could it be that NAT/router is somehow blocking port 22 for ssh traffic?

If there is any misconfiguration in sshd_config or anywhere else, i'd appreciate any feedback. thanks
 
Old 06-15-2012, 04:35 AM   #2
bakdong
Member
 
Registered: Apr 2009
Posts: 214

Rep: Reputation: 44
Yes it could, if by 'external' you mean the other side of a router. I would check that your port forwarding is functioning and also double check that the firewall is correctly allowing port 22 through.
 
Old 06-15-2012, 06:06 AM   #3
nOrVow
LQ Newbie
 
Registered: Jun 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bakdong View Post
Yes it could, if by 'external' you mean the other side of a router. I would check that your port forwarding is functioning and also double check that the firewall is correctly allowing port 22 through.
Yeah the other side of the router. By firewall - you mean the windows firewall, correct? I'll look into my port forwarding.
 
Old 06-15-2012, 08:32 AM   #4
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: rhel 5x,6.0,6.2, centOS 5x,6.0,6.2
Posts: 1,190
Blog Entries: 4

Rep: Reputation: 220Reputation: 220Reputation: 220
check the firewall on Linux server

Code:
#netstat -ntlp | grep 22
and post the output
 
Old 06-15-2012, 03:15 PM   #5
nOrVow
LQ Newbie
 
Registered: Jun 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by deep27ak View Post
check the firewall on Linux server

Code:
#netstat -ntlp | grep 22
and post the output
here it is

Quote:
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 18416/sshd
tcp6 0 0 :::22 :::* LISTEN 18416/sshd
 
Old 06-15-2012, 04:23 PM   #6
robertjinx
Member
 
Registered: Oct 2007
Location: Prague, CZ
Distribution: RedHat / CentOS / Ubuntu / SUSE / Debian
Posts: 587

Rep: Reputation: 58
You need this 2 option in /etc/ssh/sshd_config

Quote:
ClientAliveInterval 10
ClientAliveCountMax 60
After you add them at the end of sshd_config, restart sshd server and try again.
 
Old 06-15-2012, 05:23 PM   #7
nOrVow
LQ Newbie
 
Registered: Jun 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by robertjinx View Post
You need this 2 option in /etc/ssh/sshd_config



After you add them at the end of sshd_config, restart sshd server and try again.
It still gives me that same error. Can anyone me tell what I should do with my router? I have a feeling that's the issue. I even tried adding a new inbound and outbound rule for the W7 firewall to allow port 22 for ssh traffic, and the problem is still there. i'm a total noob with networking.



edit: I have fixed the issue! The virtual box network settings for my VM were configured the wrong way. Under "Network" within the settings option in VirtualBox, the "attached to:" option was set to "NAT", and apparently under this configuration you aren't to able connect to any of the services within the virtual machine. So I switched the option to "Bridged Adapter" instead and selected "Allow VMs" under promiscuous mode. This also changed the local IP on the VM to another one that's on the same subnet as my Windows host machine. So now I'm able to SSH into my VM using PuTTY and access the internet from within the VM.

Last edited by nOrVow; 06-15-2012 at 06:12 PM.
 
Old 06-17-2012, 11:46 PM   #8
deep27ak
Senior Member
 
Registered: Aug 2011
Location: Bangalore, India
Distribution: rhel 5x,6.0,6.2, centOS 5x,6.0,6.2
Posts: 1,190
Blog Entries: 4

Rep: Reputation: 220Reputation: 220Reputation: 220
Quote:
Originally Posted by robertjinx View Post
You need this 2 option in /etc/ssh/sshd_config



After you add them at the end of sshd_config, restart sshd server and try again.
I think you should re check the error which was posted by OP and I believe these options which you have provided have nothing to do with the error. These are used when a client gets disconnected due to idle putty session.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
SSH using putty throws "server unexpectedly closed connection" madhavanss Linux - Networking 4 03-16-2012 05:52 AM
Different SSH "Server unexpectedly closed network connection" (using Putty) mjwraw Linux - Networking 4 07-22-2009 08:23 AM
Mysql "connection timed out" error immortaltechnique Linux - Software 0 09-03-2007 07:52 AM
Error: "Could not connect data socket, Connection timed out." tigerflag Linux - Software 5 01-17-2006 02:26 AM
SSH PuTTy gives "connection refused" Sathington Linux - Networking 5 03-18-2004 06:10 AM


All times are GMT -5. The time now is 04:03 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration