Recently I switched server (yes, the one running this website), and I am using the command ‘screen’ to run a few services.
But here’s the drawback, unless I was logged as root, I couldn’t have a screen session running without the error :
Which after a while started to annoy me quite a bit (Typically my init script would just die without explanation since I redirect the output in /dev/null).
Most of solutions across the web recommend to change the ownership of the /dev/tty* (tty used by the user) to the current user or add the user to the group tty. Not only this is a solution that doesn’t work, but it is a dangerous one (if the user is hacked and it belongs to the tty group, it can listen to other ttys).
but thanks to the website Fooninja.net, I was able to solve this issue by running the command :
Of course you can make it permanent by adding this line to the file /etc/fstab
After a little more research looking for why this actually works, It looks like I can’t read a man and I’m unable to connect the dots :
When a process opens /dev/ptmx, it gets a file descriptor for a pseudoterminal master (PTM), and a pseudoterminal slave (PTS) device is created in the /dev/pts directory. Each file descriptor obtained by opening /dev/ptmx is an independent PTM with its own associated PTS, whose path can be found by passing the descriptor to ptsname(3).
And in my case /dev/pts/ didn’t exist / wasn’t mounted so ptmx wasn’t able to create slaves.