# telnet connection problems

## dendy

I have telnet running, it is a very bad bad thing, but I the fine people at work will not let me install any ssh programs (putty) so I am stuck with telnet.  The problem is when I 

```
 telnet 12.34.56.78 
```

 (12.34.56.78 being my ip) I get a nice message 

```
 Trying 12.34.56.78...

Connected to 12.34.56.78.

Escape character is '^]'.

Connection closed by foreign host

```

but when I 

```
telnet localhost
```

 or 

```
telnet 127.0.0.1
```

everything works fine.  

/etc/xinetd.conf looks like

```
# Sample configuration file for xinetd

defaults

{

        only_from      = localhost

        instances      = 60

        log_type       = SYSLOG authpriv info

        log_on_success = HOST PID

        log_on_failure = HOST

        cps            = 25 30

}

includedir /etc/xinetd.d

service telnet

{

flags = REUSE

socket_type = stream

wait = no

user = root

server = /usr/sbin/in.telnetd

bind = <ip_of_box>

log_on_failure += USERID

} 

```

and I have a file /etc/xinetd.d/telnet (I saw different suggestions  on the forums and I wanted to cover every angle before I posted)

```
service telnet

{

        disable         = no

        flags           = REUSE

        socket_type     = stream

        wait            = no

        user            = root

        server          = /usr/sbin/in.telnetd

        log_on_failure  += USERID

        log_on_success  += PID HOST EXIT

} 

```

many thanks in advance  :Very Happy: 

----------

## cyfred

Well firstly putty doesnt really need to be installed so you could run it off the net.

The problem with your login is that by default only localhost can access the machine remotely (this is very secure in essence of telnet).

```
# Sample configuration file for xinetd

defaults

{

        only_from      = localhost

        instances      = 60

        log_type       = SYSLOG authpriv info

        log_on_success = HOST PID

        log_on_failure = HOST

        cps            = 25 30

}

includedir /etc/xinetd.d

service telnet

{

flags = REUSE

socket_type = stream

wait = no

user = root

server = /usr/sbin/in.telnetd

bind = <ip_of_box>

log_on_failure += USERID

} 
```

See in the defaults section.

Change this to the following

```
# Sample configuration file for xinetd

defaults

{

        #only_from      = localhost

        instances      = 60

        log_type       = SYSLOG authpriv info

        log_on_success = HOST PID

        log_on_failure = HOST

        cps            = 25 30

}

includedir /etc/xinetd.d

service telnet

{

flags = REUSE

only_from = 12.34.56.78 localhost

socket_type = stream

wait = no

user = root

server = /usr/sbin/in.telnetd

bind = <ip_of_box>

log_on_failure += USERID

} 
```

To login from an external IP (naturally 12.34.56.78 must be changed to the IP you wish to access the telnet server from.

If there are other services in xinetd.conf do not comment out the default only_from = localhost, otherwise all services will be universally accessable

----------

## dendy

Thanks cyfred it worked  :Smile:   :Smile: .  Now what were you saying about running putty off the net?  I can't install any programs at work and I would rather use ssh.

----------

## cyfred

http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe

Just paste that into Start -> Run 

And open it off the net...

[Ive] kinda assumed that you are using a windows client but it kinda occurs to me now that you wouldnt be running telnet servers on windows machines, so what type of client are you actually using?

----------

## taskara

I don't seem to be able to start telnet, this is the error message:

```
server chris # /usr/sbin/telnetd

/usr/sbin/telnetd: getpeername: Socket operation on non-socket
```

I don't think anything is running on port 23

ssh is also running

thanks guys!

----------

## Naan Yaar

telnetd is normally started from "*inetd".  If you run it from the console, you need to start it up in the debug mode.

I wouldn't use telnet outside a firewalled intranet.  I cannot think of (m)any reasons to not use ssh.

----------

## taskara

got it working  :Smile: 

thanks

----------

