LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-25-2008, 02:38 PM   #1
jhilton
LQ Newbie
 
Registered: Jun 2008
Posts: 29

Rep: Reputation: 15
Telnet "Connection closed by foreign host"


Hello, I acidentally posted this in the newbie forums and then saw there was a networking forum!

I'm having problems trying to get my linux machine to accept telnet connections from any other type of machine. Whenever I try to telnet from a solaris or linux machine to the linux host machine I get a, "Connection closed by foreign host" and it returns me back to the terminal. I can Telnet/rsh/rlogin from any of the linux machines into the solaris box but the reverse can not be achieved.

On the linux machine this problem is easily solved by just using SSH, however I am unable to use SSH on the Solaris as the SSH client is not installed. On the Linux host I have telnet set to enable in my /etc/xinit.d directory and I even do a /etc/init.d/xinitd restart. xinitd is running as I can pull it out of top using grep. Any ideas as to why telnet is refusing connections?
 
Old 06-25-2008, 03:00 PM   #2
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
Have you checked you /etc/hosts.allow?
 
Old 06-25-2008, 03:10 PM   #3
jhilton
LQ Newbie
 
Registered: Jun 2008
Posts: 29

Original Poster
Rep: Reputation: 15
In etc/hosts.allow I have "ALL : ALL : ALLOW" on the linux machines. And both .rhosts and hosts.equiv have "+ +".

At this moment I've given up on all security I can achieve between these machines in order to get this networking thing to work. Once I can figure out how to get it to work, then I can start messing around and tweaking them the way I need them to work.
 
Old 06-25-2008, 03:43 PM   #4
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
Are you trying to telnet in as root or as a user? I seem to remember there is an extra setting (somewhere) about allowing remote root.
 
Old 06-25-2008, 06:06 PM   #5
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
And what about your /etc/hosts.deny ?
Are you running SELINUX?

rhosts and hosts.equiv are not relevant to telnet.
 
Old 06-25-2008, 06:23 PM   #6
jhilton
LQ Newbie
 
Registered: Jun 2008
Posts: 29

Original Poster
Rep: Reputation: 15
Hmmm... I have no idea if it is or not. The "linux" machines right now are running off customized Gentoo live cds with various programs to help back up partition images on other systems. But after doing some searching, I can assume that they are.

There was no /etc/hosts.deny file. I figure that since it did not exist I did not have to create it like I did for /etc/hosts.allow

I Just got home so I won't be able to do much more but get ideas until I get back tomorrow.
 
Old 06-25-2008, 06:30 PM   #7
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
On the linux machine that cannot be connected to via telnet, run:

telnet localhost

add show what happens.
 
Old 06-26-2008, 07:34 AM   #8
jhilton
LQ Newbie
 
Registered: Jun 2008
Posts: 29

Original Poster
Rep: Reputation: 15
Trying to telnet into machine that can not be telnet into I get...

Trying 127.0.0.1...
Connected to localhost
Escape character is '^]'.
Connection closed by foreign host.
 
Old 06-26-2008, 10:35 AM   #9
jlm01801
LQ Newbie
 
Registered: Jun 2008
Location: Massachusetts USA
Distribution: Mandriva Corporate 4
Posts: 12

Rep: Reputation: 0
sounds like maybe the telnet server is not running.
to check run netstat -an |grep 23
you should see something like...
tcp 0 0 0.0.0.0:23 0.0.0.0:* LISTEN
...port 23 being the telnet port
if you don't see it make sure you have it installed. if installed check your logs for xinetd errors concerning telnet.
 
Old 06-26-2008, 10:55 AM   #10
jhilton
LQ Newbie
 
Registered: Jun 2008
Posts: 29

Original Poster
Rep: Reputation: 15
I ran -an | grep 23 and I see

tcp 0 0.0.0.0:23 0.0.0.0:* LISTEN

So did less /var/log/messages | grep telnet and I got

Jun 26 15:41:01 sysresccd xinetd[8673]: Reading included configuration file: /etc/xinetd.d/telnetd [file=/etc/xinetd.d/telnetd] [line=68]
Jun 26 15:43:53 sysresccd xinetd[8743]: Reading included configuration file: /etc/xinetd.d/telnetd [file=/etc/xinetd.d/telnetd] [line=68]
Jun 26 15:45:46 sysresccd xinetd[8743]: START: telnet pid=8774 from=127.0.0.1
Jun 26 15:45:46 sysresccd xinetd[8774]: FAIL: telnet address from=127.0.0.1
Jun 26 15:45:46 sysresccd xinetd[8743]: EXIT: telnet status=0 pid=8774 duation=0(sec)
 
Old 06-26-2008, 11:07 AM   #11
jlm01801
LQ Newbie
 
Registered: Jun 2008
Location: Massachusetts USA
Distribution: Mandriva Corporate 4
Posts: 12

Rep: Reputation: 0
check /var/log/secure for telnet/xinetd messages
check iptables -L for firewall rule preventing telnet
 
Old 06-26-2008, 11:38 AM   #12
jhilton
LQ Newbie
 
Registered: Jun 2008
Posts: 29

Original Poster
Rep: Reputation: 15
There is no /var/log/secure

I did a find / -name 'secure' 2>results

and there was no lines written to "results"

I ran iptables -L and I got this for output

Chain PREROUTING (policy ACCEPT)
target prot opt source destination

Chain POSTROUTING (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

I have no idea what any of this means, but I'm reading the man page right now trying to understand it.
 
Old 06-26-2008, 11:47 AM   #13
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
Quote:
Originally Posted by jlm01801 View Post
sounds like maybe the telnet server is not running.
No, telnet is running. Telnet output the messages:
Code:
Connected to localhost
Escape character is '^]'.
The disconnect happens after this, and is due to a security configuration somewhere dropping the connection.

See if you have an /var/log/authpriv.

Disable telnet via xinetd. Restart xinetd.

Then, start telnetd manually on the command line, using the -debug option, and various -D options for debugging. See man telnetd on the options available for your telnetd for -D. Then make your connection and see what happens.
 
Old 06-26-2008, 12:15 PM   #14
jhilton
LQ Newbie
 
Registered: Jun 2008
Posts: 29

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Mr. C. View Post

See if you have an /var/log/authpriv.

Disable telnet via xinetd. Restart xinetd.

Then, start telnetd manually on the command line, using the -debug option, and various -D options for debugging. See man telnetd on the options available for your telnetd for -D. Then make your connection and see what happens.

I do not have /var/log/authpriv.

I'm trying to start in.telnetd -D report (just as an example, I've tried all the options and get the same following result)

in.telnetd: getpeername: Socket operation on non-socket

Am I forgetting a flag or is this not what I want to run?
 
Old 06-26-2008, 12:29 PM   #15
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
Please show the output of :

telnetd --help

I'm not sure which options your telnet supports.

You are starting telnet as root, right ?
 
  


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
telnet - connection closed by foreign host rbumann Linux - General 11 01-05-2012 08:43 AM
SSH issue ""Server unexpectedly closed network connection" Errsta_Fonzarelli Linux - Software 12 05-24-2010 02:35 PM
Telnet error "Connection closed by foreign host" without prompting login. jhilton Linux - Newbie 1 06-25-2008 06:36 PM
outlook users having "your imap server has closed the connection" problems fedora_user Linux - Server 16 12-17-2007 04:43 AM
FTP problem "connection closed by remote host" with RHEL4 and Windows 2003 hooijack Linux - Enterprise 0 03-23-2006 09:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:56 AM.

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
Open Source Consulting | Domain Registration