Contributed by jose on from the /dev/ptm dept.
Add the ptm device to pty(4). By opening /dev/ptm and using the PTMGET ioctl(2), an unprivileged process may allocate a pty and have its owner and mode set appropriately. This means that programs such as xterm and screen no longer need to be setuid. Programs using the openpty() function require zero changes and will "just work". Designed by beck@ and deraadt@; changes by beck@ with cleanup (and a rewrite of the vnode bits) by art@ and tweaks/bugfixes by me. Tested by many.
(Comments are closed)
By Peter Hessler () spambox@theapt.org on http://www.theapt.org
By Anonymous Coward () on
oh well, I'm off again for a new compile :)
By Anonymous Coward () on
Great work!
By Anonymous Coward () on
Comments
By jtorin () on
The commit above is (ofcourse) an example of the prefered solution; instead of requiring a process to have root priviledges at some point in its execution, the OS is changed to allow calls to a system function by 'anonymous' processes. This is (again, ofcourse) not applicable for every system call.
By Miod () on
However, most of these binaries are not setuid root or setgid wheel anymore; they use fine-grained user and groups which makes a compromise in these binaries slightly less dangerous.
By Anonymous Coward () on
Sorry if this is a dumb question.
Comments
By panda () on
only a terminal can provide fd 0, 1 and 2 to the process (stdin, stdout, stderr). Many programs issue the ioctl ISATTY to check for the presence of a terminal and modifiy their behavior when they it is present (for instance issue ktrace on ls, you'll see that it checks for a terminal, it allows ls to display columns in interactive mode, shells don't display prompts when no terminal is present, they don't enable job control either, ...)