keep telnet

General discussion about Gargoyle, OpenWrt or anything else even remotely related to the project

Moderator: Moderators

Post Reply
inse
Posts: 5
Joined: Wed Jan 13, 2010 6:55 pm

keep telnet

Post by inse »

Is there a chance to keep telnet enabled after the first password change?
I have an application that has telnet integrated an I cannot change it.

Ingo

Eric
Site Admin
Posts: 1443
Joined: Sat Jun 14, 2008 1:14 pm

Re: keep telnet

Post by Eric »

To do this you need to edit the start function in /etc/init.d/telnet.

inse
Posts: 5
Joined: Wed Jan 13, 2010 6:55 pm

Re: keep telnet

Post by inse »

Thanks for the repy, Eric.
I tried to modify the script like this:
# Copyright (C) 2006 OpenWrt.org
START=50

start() {
if [ \! -f /etc/passwd ] || \
awk -F: '/^root:/ && ($2 != "") && ($2 !~ /\!/) {exit 1}' /etc/p
( [ \! -x /usr/sbin/dropbear ] && [ \! -x /usr/sbin/sshd ] )
then \
telnetd -l /bin/login
fi
}

stop() {
telnetd -l /bin/login
}

I removed the "killall telnet" at the bottom and repalecd it by telnetd config from above..
But no go, telnet connection is still being refused!

Ingo

Eric
Site Admin
Posts: 1443
Joined: Sat Jun 14, 2008 1:14 pm

Re: keep telnet

Post by Eric »

Please see above: you need to change the start function, not the stop function. The stop function just tells it how to shut down.

inse
Posts: 5
Joined: Wed Jan 13, 2010 6:55 pm

Re: keep telnet

Post by inse »

Hi Eric,

I am not familiar with this script language.
Can you show me what to change to enable both telnet and ssh?
I am afraid to lock me out with ssh and telnet disabled in case of an error in the script.

Regards, Ingo

fra&co
Posts: 27
Joined: Mon Dec 07, 2009 5:21 pm

Re: keep telnet

Post by fra&co »

I don't understand what u want to do

if you want to reenable telnet:
killall -9 telnet && telnet -l /bin/login
after passwd cmd

ps: use dropbear instead

inse
Posts: 5
Joined: Wed Jan 13, 2010 6:55 pm

Re: keep telnet

Post by inse »

@ fra&co:
I modified the telnet scrip this way:
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=50

start() {
killall -9 telnet && telnet -l /bin/login
if [ \! -f /etc/passwd ] || \
awk -F: '/^root:/ && ($2 != "") && ($2 !~ /\!/) {exit 1}' /etc/p
( [ \! -x /usr/sbin/dropbear ] && [ \! -x /usr/sbin/sshd ] )
then \
telnetd -l /bin/login
fi
}

stop() {
killall telnet
}

But still the telnet connection is being refused.
What I am trying to do:
I have an application on my PC that communicates with the router via telnet.
I cannot change the protocol to ssh, as the provided DLL only support telnet.
But this is no security risk as the router is connected behind the main router running a firewall.
As I am not yet familiar to linux, I am learning it the hard way momentarly...
So I would be very glad to get a hint how to modify the init scripts.

Regards,
Ingo

Eric
Site Admin
Posts: 1443
Joined: Sat Jun 14, 2008 1:14 pm

Re: keep telnet

Post by Eric »

Ah, my mistake. You also need to edit /bin/login. Remove everything except the header and the line "exec /bin/ash --login"

Code: Select all

#!/bin/sh

exec /bin/ash --login

inse
Posts: 5
Joined: Wed Jan 13, 2010 6:55 pm

Re: keep telnet

Post by inse »

Hi Eric,

I just tried it out and it works like a charm!

Thank you!!!

Post Reply