Forkpty failed

From Linuxintro

I have a working environment and a non-working environment of shellinabox.

In the non-working environment shellinaboxd gives me

forkpty failed

as error message. Ok, let's strace it:

# ps -A| grep  shellin
  132 ?        00:00:00 shellinaboxd
  154 ?        00:00:00 shellinaboxd
# strace -p 132 -p 154
[...]
[pid   154] chown("/dev/pts/1", 65534, 5) = -1 EPERM (Operation not permitted)
[pid   154] clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fd0c22959d0) = 10036
[pid   154] wait4(10036,  <unfinished ...>
[pid   132] <... write resumed> )       = 173
[pid   132] recvmsg(3,  <unfinished ...>
[pid   154] <... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 4}], 0, NULL) = 10036
[pid   154] --- SIGCHLD (Child exited) @ 0 (0) ---
[pid   154] rt_sigreturn(0x11)          = 10036
[pid   154] close(3)                    = 0
[pid   154] pipe([3, 5])                = 0
[pid   154] write(5, "forkpty() failed\r\n", 18) = 18

In the working environment the call to chown is missing.

Solution:

shellinaboxd --user=0