Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I used ssh from another host to this new machine. Encountered the following:
ssh: connect to host 172.20.2.2 port 22: Connection refused
I check the new machine information as the follows:
========================
iptables:
Fire wall is stopped
ps outputs:
root 4002 1 0 09:23 00:00:00 /usr/sbin/sshd
port 22 status:
sshd 4002 root 3u IPv4 12673 TCP *:ssh(LISTEN)
=========================
I also can use ssh to itself.
I can not use scp to copy files from other hosts to the new machine and can not use PUTTY to log on it.
From the strace outputs i only found the following, but i can not find the root cause from it.
=========================
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
connect(3, {sa_family=AF_INET, sin_port=htons(22), sin_addr=inet_addr("172.20.2.2")}, 16) = -1 ECONNREFUSED (Connection refused)
close(3) = 0
write(2, "ssh: connect to host 172.20.2."..., 64ssh: connect to host 172.20.2.2 port 22: Connection refused
) = 64
exit_group(255) = ?
==========================
ssh -vv outputs as follows:
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 172.20.2.2 [172.20.2.2] port 22.
debug1: connect to address 172.20.2.2 port 22: Connection refused
ssh: connect to host 172.20.2.2 port 22: Connection refused
Could you check the logs on the server. Sometimes they will say why the connection was refused.
Some things that could cause problems:
Permissions of $HOME/.ssh are too lax
Permissions of $HOME are too lax
UseDNS yes in /etc/ssh/sshd_config, and you don't have a dns entry or entry in /etc/hosts
Entry in /etc/hosts has hostname.domain or hostname listed first, when other is expected. Check for username@hostname in known_hosts entry or authorized_keys entry. It's at the end.
AllowUsers is used in /etc/sshd/sshd_config and you are not listed
>>/etc/hosts.allow and /etc/hosts.deny
I just installed the OS. I didn't enter any information into these files. Thanks
>>i am root authentication
>>/etc/hosts file
Thanks for the information. I already added the hosts information into this file. I can ping outside hosts before, i suspected the hosts file wasn't the root cause, right?
I can ssh to itself, so i suspect my ssh should be installed, does it make sense?
Thanks for all your help. I have resolved the problem.
I found the ip address has a conflict with another host. I change the ip address but the issue persists.
Then i compared with the other hosts which can ssh on, i found i used a wrong gw. After i add the default gw, i can use ssh.
Allowing root logins in ssh is a bad idea. It will be targeted by script kiddies. You can disable root logins in sshd_config. If you need root cron jobs with root access, there is an option that uses key pairs for root logins, even if regular users use password authentication.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.