LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   ssh problems (https://www.linuxquestions.org/questions/linux-newbie-8/ssh-problems-741571/)

judoka 07-20-2009 11:49 PM

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?

micxz 07-20-2009 11:50 PM

Try connecting to the IP address instead of the name.

jdkaye 07-20-2009 11:57 PM

Quote:

Originally Posted by judoka (Post 3614685)
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

vinaytp 07-20-2009 11:59 PM

Quote:

Originally Posted by judoka (Post 3614685)
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??

judoka 07-21-2009 12:14 AM

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

jschiwal 07-21-2009 12:21 AM

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.

vinaytp 07-21-2009 12:21 AM

Quote:

Originally Posted by judoka (Post 3614713)
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...

judoka 07-21-2009 12:24 AM

what does DNS config setting no mean?

micxz 07-21-2009 12:29 AM

Quote:

Originally Posted by vinaytp (Post 3614719)
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 .

judoka 07-21-2009 12:29 AM

I don't have an etc/hosts file

jschiwal 07-21-2009 12:44 AM

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.

chrism01 07-21-2009 12:50 AM

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

judoka 07-21-2009 01:00 AM

OK, i found my local hosts file. what does DNS - setting no do? and how do i check my ssh dameon?

judoka 07-21-2009 01:07 AM

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?

jschiwal 07-21-2009 08:59 AM

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.


All times are GMT -5. The time now is 08:37 PM.