User Tools

Site Tools


inbox:howto:telnet_enable

Enable telnet login with password

(Without dropbear)

This is useful if you don't mind security and you don't have enough space or resources for dropbear in your device. Tested succesfully in Backfire 10.03.2

  1. Patch your build tree with this file:
    Index: package/base-files/files/bin/login.sh
    ===================================================================
    --- package/base-files/files/bin/login.sh	(revision: 33603)
    +++ package/base-files/files/bin/login.sh	(copia de trabajo)
    @@ -2,15 +2,14 @@
     # Copyright (C) 2006-2010 OpenWrt.org
     
     if grep -qs '^root:[^!]' /etc/passwd /etc/shadow && [ -z "$FAILSAFE" ]; then
    -	echo "Login failed."
    -	exit 0
    +	echo "WARNING: telnet is a security risk"
    +	busybox login
     else
     cat << EOF
      === IMPORTANT ============================
       Use 'passwd' to set your login password
    -  this will disable telnet and enable SSH
    +  this will enable telnet login with password
      ------------------------------------------
     EOF
    +exec /bin/ash --login
     fi
    -
    -exec /bin/ash --login
    Copy the above content to a file: telnet_enable.patch. And patch your build tree
    patch -p0 -i telnet_enable.patch
  2. Configure the build tree
    make menuconfig
    Enable login at Location:
    -> Base system 
       -> busybox
         -> Configuration 
            -> Login/Password Management Utilities
    ┌──────────────────────── Login/Password Management Utilities ────────────────────────┐
    │ ┌─────────────────────────────────────────────────────────────────────────────────┐ │  
    │ │ [ ] Support for shadow passwords                                                │ │  
    │ │ [ ] Use internal password and group functions rather than system functions      │ │  
    │ │ [ ] Use internal crypt functions                                                │ │  
    │ │ [ ] addgroup                                                                    │ │  
    │ │ [ ] delgroup                                                                    │ │  
    │ │ [ ] adduser                                                                     │ │  
    │ │ [ ] deluser                                                                     │ │  
    │ │ [ ] getty                                                                       │ │  
    │ │ [ ]   Support utmp file (NEW)                                                   │ │  
    │ │ [ ]   Support wtmp file (NEW)                                                   │ │  
    │ │ [*] login                                                                       │ │  
    │ │ [ ]   Support for PAM (Pluggable Authentication Modules) (NEW)                  │ │  
    │ │ [ ]   Support for login scripts (NEW)                                           │ │  
    │ │ [ ]   Support for /etc/nologin (NEW)                                            │ │  
    │ │ [ ]   Support for /etc/securetty (NEW)                                          │ │  
    │ │ [*] passwd                                                                      │ │  
    │ │ [ ]   Check new passwords for weakness                                          │ │  
    │ │ [ ] cryptpw                                                                     │ │  
    │ └─v(+)────────────────────────────────────────────────────────────────────────────┘ │  
    ├─────────────────────────────────────────────────────────────────────────────────────┤  
    │                          <Select>    < Exit >    < Help >                           │  
    └─────────────────────────────────────────────────────────────────────────────────────┘ 
    Disable dropbear at Location:
     -> Base system
    ┌──────────────────────────────────── Base system ────────────────────────────────────┐
    │ ┌─────────────────────────────────────────────────────────────────────────────────┐ │  
    │ │ <*> base-files................................... Base filesystem for OpenWrt   │ │  
    │ │ < > block-hotplug...................... Automount and autocheck block devices   │ │  
    │ │ < > br2684ctl.................... ATM Ethernet bridging configuration utility   │ │  
    │ │ < > bridge........................... Ethernet bridging configuration utility   │ │  
    │ │ <*> busybox................................ Core utilities for embedded Linux  -│ │  
    │ │ < > dnsmasq................................ A lightweight DNS and DHCP server   │ │  
    │ │ < > dropbear........................................ Small SSH2 client/server   │ │  
    │ │ < > ead.............................................. Emergency Access Daemon   │ │  
    │ │ < > firewall................................................ OpenWrt firewall   │ │  
    │ │ <*> hotplug2                                                                    │ │  
    │ │ <*> libc........................................................... C library   │ │  
    │ │ <*> libgcc............................................... GCC support library   │ │  
    │ │ --- libpthread.......................................... POSIX thread library   │ │  
    │ │ --- librt................................ POSIX.1b RealTime extension library   │ │  
    │ │ < > libstdcpp.................................... GNU Standard C++ Library v3   │ │  
    │ │ <*> mtd............................... Update utility for trx firmware images   │ │  
    │ │ <*> opkg...................................... opkg package management system   │ │  
    │ └─v(+)────────────────────────────────────────────────────────────────────────────┘ │  
    ├─────────────────────────────────────────────────────────────────────────────────────┤  
    │                          <Select>    < Exit >    < Help >                           │  
    └─────────────────────────────────────────────────────────────────────────────────────┘ 
  3. Now compile OpenWrt
    make V=99
  4. Flash the built firmware into your device. Set a password with passwd. Next time you login via telnet it will prompt your root password.
inbox/howto/telnet_enable.txt · Last modified: 2013/06/27 12:25 (external edit)