Telnet

From ArmadeusWiki
Revision as of 16:03, 8 October 2009 by JulienB (Talk | contribs) (Host)

Jump to: navigation, search

From Wikipedia:
"Telnet (Telecommunication network) is a network protocol used on the Internet or local area network (LAN) connections. It was developed in 1969 beginning with RFC 15 and standardized as IETF STD 8, one of the first Internet standards. Typically, telnet provides access to a command-line interface on a remote machine.
The term telnet also refers to software which implements the client part of the protocol."

Installation

Telnet client and server are installed by default on the standard Armadeus rootfs. (Included in Busybox).
As it's not a good idea to log in as root through Telnet, create a user that you will use when connecting:

 # adduser guest
 Changing password for guest
 New password:
 Retype password:
 Password for guest changed by root

Usage

Target

Telnet server (telnetd) is launched by inetd when someone is trying to access port 23. This behaviour can be configured in /etc/inetd.conf:

 # cat /etc/inetd.conf
 23      stream  tcp     nowait  root    /usr/sbin/telnetd telnetd -l /bin/login

If so you just have to launch inetd daemon at the start of your system. You can for example add the following script on your APF as /etc/init.d/S60inetd (for convenience, a copy of this script can be found in target/scripts/) :

#! /bin/sh
 
[ -f /usr/sbin/inetd ] || exit 0
 
RETVAL=0
 
# See how we were called.
case "$1" in
	start)
		echo -n "Starting INET services: "
		inetd
		RETVAL=$?
		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/inet && echo "done"
		;;
	stop)
		echo -n "Stopping INET services: "
		killall inetd
		RETVAL=$?
		[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/inet && echo "done"
		;;
	status)
		echo -n "INET services are: "
		if [ -f /var/lock/subsys/inet ]; then
			echo "running"
		else
			echo "not running"
		fi
		;;
	restart)
		$0 stop
		$0 start
		RETVAL=$?
		;;
	reload)
		killall -HUP inetd
		RETVAL=$?
		;;
	*)
		echo "Usage: $0 {start|stop|status|reload|restart}"
		exit 1
esac
 
exit $RETVAL

Host

When you're sure that inetd is running on your target, launch the connection that way on your PC:

$ telnet 192.168.0.10
Trying 192.168.0.10...
Connected to 192.168.0.10.

From here we do as if we were directly connected on the target:

Escape character is '^]'.
armadeus login: guest
Password:
$ uname -a       (to check you're really on your board ;-) )
Linux armadeus 2.6.27.2 #1 PREEMPT Thu Dec 4 14:09:27 CET 2008 armv4tl unknown

Links