Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
help with telnet setup - closes immediately by foreign host
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
m27315
Apprentice
Apprentice


Joined: 10 Dec 2004
Posts: 253
Location: 2 workstations down

PostPosted: Fri Jun 20, 2008 7:19 pm    Post subject: help with telnet setup - closes immediately by foreign host Reply with quote

I am trying to follow this Gentoo-Wiki HOWTO: http://gentoo-wiki.com/HOWTO_telnetd. It is fairly straightforward, except the modern version of telnetd sucks in xinetd, not inetd, so a little translation is required.

My problem is that when I try to telnet into my new Gentoo telnet server, it is immediately closed without asking for password or anything, like so:

Code:
# telnet <my_gentoo_telnet_server>
Trying <IP_address>...
Connected to <my_gentoo_telnet_server>.
Escape character is '^]'.
Connection closed by foreign host.

Any guesses as to what is wrong?

Here is what I did, plus config files:

Code:
# emerge netkit-base
# emerge netkit-telnetd
# groupadd -g 300 telnetd
# useradd -u 300 -g 300 telnetd
# usermod -aG telnetd <my_user>
# /etc/init.d/xinetd restart

/etc/xinetd.conf
Code:
defaults
{
        log_type        = SYSLOG daemon info
        log_on_failure  = HOST
        log_on_success  = PID HOST DURATION EXIT
        only_from       = localhost
        cps             = 50 10
        instances       = 50
        per_source      = 10
        v6only          = no
        groups          = yes
        umask           = 002
}
includedir /etc/xinetd.d

/etc/xinetd.d/telnetd
Code:
service telnet
{
        flags           = REUSE
        socket_type     = stream
        wait            = no
        user            = telnetd
        server          = /usr/sbin/in.telnetd
        log_on_failure += USERID
        disable         = no
}

What am I missing? I feel like it is something obvious...
Back to top
View user's profile Send private message
m27315
Apprentice
Apprentice


Joined: 10 Dec 2004
Posts: 253
Location: 2 workstations down

PostPosted: Fri Jun 20, 2008 8:25 pm    Post subject: success! Reply with quote

Ok, I got it working. Here's the simplified solution with updated config files (see below...). In summary, there were two problems. The defaults for xinetd only allow connections from localhost. That line must be commented out. With that fixed, you get a "Permission denied" error, like the Wiki mentions. The problem here is that telnetd must be run as root. The telnetd user (#300) does not have sufficient privileges, and I do not know how to grant it the appropriate permissions. (It probably needs to be added to some group.) So, you have to use root.

Procedure:
Code:
# emerge netkit-telnetd

Edit config files like so:

/etc/xinetd.conf
Code:
#
# This is the master xinetd configuration file. Settings in the
# default section will be inherited by all service configurations
# unless explicitly overridden in the service configuration. See
# xinetd.conf in the man pages for a more detailed explanation of
# these attributes.

defaults
{
# The next two items are intended to be a quick access place to
# temporarily enable or disable services.
#
#       enabled         =
#       disabled        =

# Define general logging characteristics.
        log_type        = SYSLOG daemon info
        log_on_failure  = HOST
        log_on_success  = PID HOST DURATION EXIT

# Define access restriction defaults
#
#       no_access       =
#       only_from       =
#       max_load        = 0
        cps             = 50 10
        instances       = 50
        per_source      = 10

# Address and networking defaults
#
#       bind            =
#       mdns            = yes
        v6only          = no

# setup environmental attributes
#
#       passenv         =
        groups          = yes
        umask           = 002

# Generally, banners are not used. This sets up their global defaults
#
#       banner          =
#       banner_fail     =
#       banner_success  =
}

includedir /etc/xinetd.d

/etc/xinetd.d/telnetd
Code:
service telnet
{
        flags           = REUSE
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/sbin/in.telnetd
        log_on_failure += USERID
        disable         = no
}

Now, begin xinetd, which controls and begins telnet:

Code:
# /etc/init.d/xinetd restart

If all goes well, add it to your start-up procedure:

Code:
# rc-update add xinetd default

HTH
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum