Allow non-root users to write to stdout/stderr

Actual files backing stdin/out/err for entrypoint (main / server) process are pipes (code) owned by run-as user.

# from fly ssh console; where 520 is the entrypoint-pid (server process)
# fd/1 is stdout
ls -lhtr /proc/520/fd/1
l-wx------    1 <run-as>     <run-as>          64 Jan 26 21:58 /proc/520/fd/1 -> pipe:[4403]
...

I not am really sure, but I believe the reason why writing to /dev/stdout from fly ssh (interactive shell) doesn’t work is because the char device /dev/pts/1 is owned by root with no world permissions even if the link /proc/<entrypoint-pid>/fd/1 is owned by USER (shell-user) one is running the interactive shell as.

# from fly ssh console; su <shell-user>
ls -lhtr /dev/pts/0 
...
crw--w----    1 root     tty       136,   0 Jan 26 22:15 /dev/pts/0
...
ls -lhtr /proc/self/fd/1
lrwx------    1 <shell-user>     <shell-user>          64 Jan 26 22:15 /proc/self/fd/1 -> /dev/pts/0
1 Like