Linux - Networking This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
06-25-2008, 02:38 PM
|
#1
|
LQ Newbie
Registered: Jun 2008
Posts: 29
Rep:
|
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?
|
|
|
06-25-2008, 03:00 PM
|
#2
|
Senior Member
Registered: Jan 2006
Posts: 4,363
Rep: 
|
Have you checked you /etc/hosts.allow?
|
|
|
06-25-2008, 03:10 PM
|
#3
|
LQ Newbie
Registered: Jun 2008
Posts: 29
Original Poster
Rep:
|
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.
|
|
|
06-25-2008, 03:43 PM
|
#4
|
Senior Member
Registered: Jan 2006
Posts: 4,363
Rep: 
|
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.
|
|
|
06-25-2008, 06:06 PM
|
#5
|
Senior Member
Registered: Jun 2008
Posts: 2,529
Rep:
|
And what about your /etc/hosts.deny ?
Are you running SELINUX?
rhosts and hosts.equiv are not relevant to telnet.
|
|
|
06-25-2008, 06:23 PM
|
#6
|
LQ Newbie
Registered: Jun 2008
Posts: 29
Original Poster
Rep:
|
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.
|
|
|
06-25-2008, 06:30 PM
|
#7
|
Senior Member
Registered: Jun 2008
Posts: 2,529
Rep:
|
On the linux machine that cannot be connected to via telnet, run:
telnet localhost
add show what happens.
|
|
|
06-26-2008, 07:34 AM
|
#8
|
LQ Newbie
Registered: Jun 2008
Posts: 29
Original Poster
Rep:
|
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.
|
|
|
06-26-2008, 10:35 AM
|
#9
|
LQ Newbie
Registered: Jun 2008
Location: Massachusetts USA
Distribution: Mandriva Corporate 4
Posts: 12
Rep:
|
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.
|
|
|
06-26-2008, 10:55 AM
|
#10
|
LQ Newbie
Registered: Jun 2008
Posts: 29
Original Poster
Rep:
|
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)
|
|
|
06-26-2008, 11:07 AM
|
#11
|
LQ Newbie
Registered: Jun 2008
Location: Massachusetts USA
Distribution: Mandriva Corporate 4
Posts: 12
Rep:
|
check /var/log/secure for telnet/xinetd messages
check iptables -L for firewall rule preventing telnet
|
|
|
06-26-2008, 11:38 AM
|
#12
|
LQ Newbie
Registered: Jun 2008
Posts: 29
Original Poster
Rep:
|
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.
|
|
|
06-26-2008, 11:47 AM
|
#13
|
Senior Member
Registered: Jun 2008
Posts: 2,529
Rep:
|
Quote:
Originally Posted by jlm01801
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.
|
|
|
06-26-2008, 12:15 PM
|
#14
|
LQ Newbie
Registered: Jun 2008
Posts: 29
Original Poster
Rep:
|
Quote:
Originally Posted by Mr. C.
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?
|
|
|
06-26-2008, 12:29 PM
|
#15
|
Senior Member
Registered: Jun 2008
Posts: 2,529
Rep:
|
Please show the output of :
telnetd --help
I'm not sure which options your telnet supports.
You are starting telnet as root, right ?
|
|
|
All times are GMT -5. The time now is 11:21 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|