3 ms·
> I do not rely on /dev/null. > I make my own null character devices as I need them. Why? Is there ever a reason to have more than one file on your system whi
by derleth 13y ago
> I do not rely on /dev/null.
> I make my own null character devices as I need them.
Why? Is there ever a reason to have more than one file on your system which acts as a /dev/null?
- gwu78 13y ago"Why?" Why not? In my case, the reason is because it's shorter to type. I would expect most longtime UNIX users have experienced what happens when, for one reason or another, /dev/null is not a null character device and you have scripts or programs writing to it as if it was. By the time you realize that this has happened, it's too late -- data has already been saved to this file. There may be various workarounds for this. I'm not a professional sysadmin. But in my case, for my own personal usage systems, by using my own null character device in my own tmpfs mounted folders, I can just test for the success/failure of the mknod command before I start redirecting anything to it. I don't need a /dev/null. But I do need mknod.
- anyfoo 13y agoAnd you need to be root, apparently.
- gwu78 13y agosetuidgid luser mknod ... Are you sure?
- anyfoo 13y agoGreat. You just gave luser at least read access to a whole lot of your hardware, including your whole hard disks, swap space, and some device nodes which potentially crash the system upon random reading.
- gwu78 13y agoMy system has only one user: me. I am the only one using it. Multiuser UNIX is a relic from a long past era of shared computing. The "root" concept creates more security issues than it solves. That's why Plan 9 did away with it.
- gwu78 13y ago"Is there ever a reason to have more than one..." Yes. It's called a chroot jail. One often needs mknod to build chroot jails because the program or programs that one intends to run in the chrooted in the jail directory require access to certain device files.