Page 1 of 1

keep telnet

Posted: Wed Jan 13, 2010 6:58 pm
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

Re: keep telnet

Posted: Thu Jan 14, 2010 8:40 am
by Eric
To do this you need to edit the start function in /etc/init.d/telnet.

Re: keep telnet

Posted: Thu Jan 14, 2010 1:59 pm
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

Re: keep telnet

Posted: Fri Jan 15, 2010 9:23 am
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.

Re: keep telnet

Posted: Sun Jan 17, 2010 1:32 pm
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

Re: keep telnet

Posted: Tue Jan 19, 2010 3:46 pm
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

Re: keep telnet

Posted: Sun Jan 24, 2010 9:16 am
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

Re: keep telnet

Posted: Tue Jan 26, 2010 9:35 am
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

Re: keep telnet

Posted: Sat Jan 30, 2010 11:19 am
by inse
Hi Eric,

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

Thank you!!!