LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 07-21-2009, 12:49 AM   #1
judoka
Member
 
Registered: Jul 2009
Distribution: Ubuntu 14.04 LTS, CentOS
Posts: 218

Rep: Reputation: 16
Question ssh problems


I have problems connecting through ssh. I followed the tutorials and set-up shh on my ubuntu 9.04; however, when i try to connect through ssh it either just stalls but the cursor is still blinking or gives me this error: ssh: Could not resolve hostname ... Name or service not known. Am i doing something wrong? I have the same problem with telnet. What could be the problem?
 
Old 07-21-2009, 12:50 AM   #2
micxz
Senior Member
 
Registered: Oct 2002
Location: CA
Distribution: openSuSE, Cent OS, Slackware
Posts: 1,131

Rep: Reputation: 75
Try connecting to the IP address instead of the name.
 
Old 07-21-2009, 12:57 AM   #3
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
Quote:
Originally Posted by judoka View Post
I have problems connecting through ssh. I followed the tutorials and set-up shh on my ubuntu 9.04; however, when i try to connect through ssh it either just stalls but the cursor is still blinking or gives me this error: ssh: Could not resolve hostname ... Name or service not known. Am i doing something wrong? I have the same problem with telnet. What could be the problem?
What exactly are you trying to connect to? Whatever hostname you entered could not be resolved (converted to an ip number) by your system. That would also account for your telnet problem as well. Do you have a dns server running? Are you giving ssh a correct hostname - one that you know exists? no mispellings?
jdk
 
Old 07-21-2009, 12:59 AM   #4
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Rep: Reputation: 55
Quote:
Originally Posted by judoka View Post
I have problems connecting through ssh. I followed the tutorials and set-up shh on my ubuntu 9.04; however, when i try to connect through ssh it either just stalls but the cursor is still blinking or gives me this error: ssh: Could not resolve hostname ... Name or service not known. Am i doing something wrong? I have the same problem with telnet. What could be the problem?

Way to use ssh :

ssh username@ipaddress

then It will ask for password of username...and also username should not block ssh services in his/her firewall....hope ur sshd demon running...

can u give some more information about ur login..how u tried?? command used etc??
 
Old 07-21-2009, 01:14 AM   #5
judoka
Member
 
Registered: Jul 2009
Distribution: Ubuntu 14.04 LTS, CentOS
Posts: 218

Original Poster
Rep: Reputation: 16
this is what my terminal is shwing yuri@yuri-desktop:~$ ssh -l yuri -p 23 127.0.0.1 and then nothing. the cursor goes on the next line and just keeps blinking
 
Old 07-21-2009, 01:21 AM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Are both machines local? You can change the "useDNS" config setting to no in /etc/ssh/sshd_conf. If you only have a few hosts on your LAN, you could instead add them to the /etc/hosts file of the ssh server. At the ssh server, run
getent hosts <remote hostname>
to check if you can resolve these local addresses.

Also:
  • try "ssh -vv user@hostname" to provide verbose information on what the problem might be.
  • Check the firewall on the remote host. It could be blocking the port.
  • If you changed the port that ssh answers, you need to use the same port number when you use the client. You also need to open the same port in the servers firewall instead of 22.
  • Check if the ssh daemon is running on the remote server.
  • Check the logs on the remote server. It could indicate what the failure is. This doesn't look like an authentication failure however.
  • For a quick connectivity check you can run "telnet hostname 22". You won't get further than that, but if you see "ssh <version>", You have connectivity and the service is running.

Last edited by jschiwal; 07-21-2009 at 01:48 AM.
 
Old 07-21-2009, 01:21 AM   #7
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Rep: Reputation: 55
Quote:
Originally Posted by judoka View Post
this is what my terminal is shwing yuri@yuri-desktop:~$ ssh -l yuri -p 23 127.0.0.1 and then nothing. the cursor goes on the next line and just keeps blinking
ok fine...do one thing add yuri in /etc/hosts file as follows

127.0.0.1 <tab> yuri

now try : ssh yuri@localhost this should work and also check whether your firewall is blocking ssh i.e, port 23 is open..In my system ssh is working on port 22....still any issues let us know...

Last edited by vinaytp; 07-21-2009 at 01:23 AM.
 
Old 07-21-2009, 01:24 AM   #8
judoka
Member
 
Registered: Jul 2009
Distribution: Ubuntu 14.04 LTS, CentOS
Posts: 218

Original Poster
Rep: Reputation: 16
what does DNS config setting no mean?
 
Old 07-21-2009, 01:29 AM   #9
micxz
Senior Member
 
Registered: Oct 2002
Location: CA
Distribution: openSuSE, Cent OS, Slackware
Posts: 1,131

Rep: Reputation: 75
Quote:
Originally Posted by vinaytp View Post
ok fine...do one thing add yuri in /etc/hosts file as follows

127.0.0.1 <tab> yuri
You mean:
127.0.0.1 <tab> localhost

this is probably in there. But maybe not.

-v will give you more info on what's going on hopefully. Also tail your secure log or where you sshd logs to. Then try

ssh -v -p 23 yuri@127.0.0.1

If none of this is working post the result of:

Code:
cat /etc/ssh/sshd_config | grep ^# | grep .
 
Old 07-21-2009, 01:29 AM   #10
judoka
Member
 
Registered: Jul 2009
Distribution: Ubuntu 14.04 LTS, CentOS
Posts: 218

Original Poster
Rep: Reputation: 16
I don't have an etc/hosts file
 
Old 07-21-2009, 01:44 AM   #11
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
The /etc/hosts file you need for this problem is in the ssh server. However it is odd not to have an /etc/hosts file on any of your hosts, because at least localhost should be listed in it.
Code:
#
# hosts         This file describes a number of hostname-to-address
#               mappings for the TCP/IP subsystem.  It is mostly
#               used at boot time, when no name servers are running.
#               On small systems, this file can be used instead of a
#               "named" name server.
# Syntax:
#
# IP-Address  Full-Qualified-Hostname  Short-Hostname
#

127.0.0.1       localhost

# special IPv6 addresses
::1             localhost ipv6-localhost ipv6-loopback

fe00::0         ipv6-localnet

ff00::0         ipv6-mcastprefix
ff02::1         ipv6-allnodes
ff02::2         ipv6-allrouters
ff02::3         ipv6-allhosts
The original /etc/hosts file should have been supplied by the "netcfg" package. This package also supplies other network configuration files as well
Code:
/etc/HOSTNAME
/etc/aliases
/etc/defaultdomain
/etc/ethers
/etc/exports
/etc/ftpusers
/etc/host.conf
/etc/hosts
/etc/hosts.allow
/etc/hosts.deny
/etc/hosts.equiv
/etc/hosts.lpd
/etc/netgroup
/etc/networks
/etc/protocols
/etc/services
This is for my SuSE laptop, but Ubuntu also has a "netcfg" package. If these files are missing, the netcfg package may not have installed correctly.
 
Old 07-21-2009, 01:50 AM   #12
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
1. /etc/hosts is a default file in all Linux distros.
2. ssh runs on port 22 by default, so use that one unless you have edited the sshd_config file
3. run 'iptables -Ln' to see if firewall is blocking the cxn.
4. use 'ps -ef|grep sshd' to check if ssh daemon is up
 
Old 07-21-2009, 02:00 AM   #13
judoka
Member
 
Registered: Jul 2009
Distribution: Ubuntu 14.04 LTS, CentOS
Posts: 218

Original Poster
Rep: Reputation: 16
OK, i found my local hosts file. what does DNS - setting no do? and how do i check my ssh dameon?
 
Old 07-21-2009, 02:07 AM   #14
judoka
Member
 
Registered: Jul 2009
Distribution: Ubuntu 14.04 LTS, CentOS
Posts: 218

Original Poster
Rep: Reputation: 16
Thanks for all the help, i tried telnet> open -l username -a host port and it says: Trying and an ip address but connection just timed out so i guess i can't establish a three-way-handshake could it be that my isp doesn't allow telnet or ssh usage?
 
Old 07-21-2009, 09:59 AM   #15
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Just enter "telnet <hostname> 22". You don't want to use the telnet protocol. You want to use the telnet client to test the connection on port 22.

For the UseDNS question. Please see the sshd_config manpage. If you don't have a domain name, performing a dns lookup can cause a delay.

I doubt that your ISP blocks port 22.

Last edited by jschiwal; 07-21-2009 at 05:47 PM.
 
  


Reply

Tags
ssh, telnet, ubuntu


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 access problems: Can only allow users SSH access by adding to root group dhupke Slackware 10 12-21-2008 10:48 AM
ssh-problems sysspy Linux - Newbie 2 12-20-2008 08:25 AM
Ssh Problems.. bambeklis Linux - Networking 4 10-06-2005 04:50 AM
ssh problems aizkorri Linux - Networking 6 06-07-2004 11:06 AM
ssh problems again saturn_vk Linux - Networking 5 03-19-2003 08:07 PM


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