On Wednesday 01 February 2012 12:56, Jonathan Andrews wrote:
> To help me develop a few things on a arm board i'm tring to get a remote
> shell working.
> 
> Firstly I tried to set the arm board up for telnet
> 
> The kernel config has this
> CONFIG_UNIX98_PTYS=y
> CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
> 
> Kernel 2.6.36.4
> 
> Busybox 1.19.2
> config has this :
> CONFIG_FEATURE_DEVPTS=y
> 
> 
> The arm board itself after boot and laughably small rc script.
> # mount
> rootfs on / type rootfs (rw)
> /dev/root on / type ext2 (rw,relatime,errors=continue)
> /proc on /proc type proc (rw,relatime)
> none on /sys type sysfs (rw,relatime)
> none on /dev/pts type devpts (rw,relatime,mode=600,ptmxmode=000)

Mine is just "none on /dev/pts type devpts (rw,relatime,mode=600)".
Are you sure "ptmxmode=000" is a good idea?


> # telnetd -l /bin/bash -F
> telnetd: can't find free pty
> 
> Oh dear ... Can anyone help here.

Sure. Lets see what working telnetd does:

# strace telnetd -l /bin/bash -F
execve("/bin/telnetd", ["telnetd", "-l", "/bin/bash", "-F"], [/* 33 vars */]) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
getuid32()                              = 0
socket(PF_INET6, SOCK_STREAM, IPPROTO_IP) = 3
brk(0)                                  = 0x811d000
brk(0x811e000)                          = 0x811e000
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(3, {sa_family=AF_INET6, sin6_port=htons(23), inet_pton(AF_INET6, "::", 
&sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0
listen(3, 1)                            = 0
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGCHLD, {SIG_IGN}, {SIG_DFL}, 8) = 0
select(4, [3], [], NULL, NULL

....here I connect to it...

)          = 1 (in [3])
accept(3, 0, NULL)                      = 4
fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
brk(0x811f000)                          = 0x811f000
open("/dev/ptmx", O_RDWR|O_LARGEFILE)   = 5
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
here is what you need to have, and probably don't.

ioctl(5, TIOCSPTLCK, [0])               = 0
ioctl(5, TIOCGPTN, [4])                 = 0
fcntl64(5, F_GETFL)                     = 0x8002 (flags O_RDWR|O_LARGEFILE)
fcntl64(5, F_SETFL, O_RDWR|O_NONBLOCK|O_LARGEFILE) = 0
fcntl64(5, F_SETFD, FD_CLOEXEC)         = 0
setsockopt(4, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
fcntl64(4, F_GETFL)                     = 0x2 (flags O_RDWR)
fcntl64(4, F_SETFL, O_RDWR|O_NONBLOCK)  = 0
write(4, "\377\375\1\377\375\37\377\373\1\377\373\3", 12) = 12
vfork()                                 = 5225
...
...

So. Do you have this node? -

# ls -l /dev/ptmx
crw-rw----    1 root     root        5,   2 Feb  2 01:59 /dev/ptmx

If yes - run strace and conpare yours to mine.


> Never mind I say to myself I can always use netcat .. :-( Nope !
> # nc -l -p 2222 -e /bin/bash
> 
> 
> >From remote host ......
> [jon@jonspc ~]$ telnet 10.10.10.111 2222
> Trying 10.10.10.111...
> Connected to 10.10.10.111.
> Escape character is '^]'.
> 
> /bin/bash: line 1: $'\r': command not found
> 
> /bin/bash: line 2: $'\r': command not found
> ls -l
> 's: invalid option -- '
> BusyBox v1.19.2 (2012-01-21 23:57:00 GMT) multi-call binary.
> 
> Usage: ls [-1AaCxdLHRFplinsehrSXvctu] [-w WIDTH] [FILE]...
> 
> 
> etc etc etc, seems to be some strange line expansion thing going on, I
> don't understand. Help welcome :-)

I tried it and I see nothing like this on my machine.
Can you strace the netcat?

-- 
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to