OpenWrt Forum Archive

Topic: Enable Telnet in Chaos Calmer

The content of this topic has been archived on 26 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello,
is it possible to enable telnet on chaos calmer? I only need the telnet access for logging. So it would be finde if i can use both telnet & ssh?
But as far as i know if i set a root password telnet would be disabled. But there must be a way ti reenable it or?

Thanks for help!

The service start script /etc/init.d/telnet does the checks and already runs by default. Edit that script to remove the checks - it is a simple if block around the lines that start the telnetd program.

Seems not to be so easy, i already tried to remove this block for checking the secrets.
The telnet deamon will start, but i was not able to connect using telnet.

check /etc/init.d/telnet and comment irrelevant from start section and see that telnet needs  /bin/login.sh script as argument
edit /bin/login.sh and cut irrelevant parts

tested and works
ps: check this http://wiki.openwrt.org/inbox/howto/telnet_enable

(Last edited by makarel on 13 Sep 2015, 16:40)

Thanks, got it now working, but not such as i need it sad
The login works, but there is the "username" check missing, where you enter root.
And now my scripts won't work.

OpenWrt is single user by default, maybe that's your problem?

yeah, that i already know.

but what i mean is when i connect via telnet that i get the prompt to enter the username "root" before login into the busybox.

n4p wrote:

yeah, that i already know.

but what i mean is when i connect via telnet that i get the prompt to enter the username "root" before login into the busybox.

so why dont you use ssh? if you want usr:pass prompt??
with telnet you are logged in as root you can do whatever

(Last edited by makarel on 13 Sep 2015, 17:25)

yeah you got right, that would be the smartest way and also the safest. but the problem what i have is that on this engine where are my scripts running ssh don't work and only telnet is implementet.

read that link i gave you higher.. and see the script from login.sh.. seems you can add password for user but read unsafe...

edit: well from that link i gave you.. seems needs busybox login but throws applet not found .. maybe you need to compile fw as per link or reinstall busybox..

(Last edited by makarel on 13 Sep 2015, 17:59)

I has been using this simple trick/fix for a while to enable telnet on my routers by just replace a file content

just replace the /bin/login.sh content with this one.

#!/bin/sh
# Copyright (C) 2006-2011 OpenWrt.org

if ( ! grep -qs '^root:[!x]\?:' /etc/shadow || \
     ! grep -qs '^root:[!x]\?:' /etc/passwd ) && \
   [ -z "$FAILSAFE" ]
then
echo "###################"
echo "### Ksr Box 1.0 ###"
echo "###################"
echo " "
cat /proc/sys/kernel/hostname
echo " "
echo " "
    ssh 127.0.0.1
else
cat << EOF
=== IMPORTANT ===============================
  Use 'passwd' to set your login password
  this will enable telnet login with password
---------------------------------------------
EOF
exec /bin/ash --login
fi

edit the header in the ### to match your desired Hi message.

this basic fix basically self ssh the router itself asking for a password via telnet, if the password is correct, you can enter comands, else, you have to reconnect.

the bad thing is that it only ask for a password, instead for username and password.
but well, most attackers would focus on the root account anyway, so is not an issue for me

(Last edited by kasar on 13 Sep 2015, 22:17)

nice trick

The discussion might have continued from here.