Yufang Zhang
2010-Apr-15 11:18 UTC
[Libguestfs] Should umask takes effect when we create device file via mknod?
Hi all, Currently, umask takes effect when we create device file via mknod, as bellow commands show: ><fs> mknod-b 0760 8 1 /dev/sdf ><fs> ll /dev/sdf brwxr----- 1 root root 8, 1 Apr 15 11:10 /sysroot/dev/sdf But I wonder whether it is reasonable? For mknod(1), when we use option -m mode, we set file permission bits to MODE, not a=rw - umask. Should this also be applicable to mknod in guestfish, thus when we create device file with mode set, umask doesn't take effect?
Richard W.M. Jones
2010-Apr-17 08:37 UTC
[Libguestfs] Should umask takes effect when we create device file via mknod?
On Thu, Apr 15, 2010 at 07:18:15PM +0800, Yufang Zhang wrote:> Hi all, > Currently, umask takes effect when we create device file via mknod, as > bellow commands show: > ><fs> mknod-b 0760 8 1 /dev/sdf > ><fs> ll /dev/sdf > brwxr----- 1 root root 8, 1 Apr 15 11:10 /sysroot/dev/sdf > > But I wonder whether it is reasonable? For mknod(1), when we use option > -m mode, we set file permission bits to MODE, not a=rw - umask. Should > this also be applicable to mknod in guestfish, thus when we create > device file with mode set, umask doesn't take effect?I think it's reasonable for us to use the umask, but probably it should be better documented. In the daemon we use the mknod(2) system call which is documented to be affected by umask: The permissions are modified by the process?s umask in the usual way: the permissions of the created node are (mode & ~umask). But the behaviour is a little bit different from the mknod(1) program. We could add a mknod-mode command (see also mkdir-mode). If you think this is worth it, then please file a bug or send a patch. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://et.redhat.com/~rjones/libguestfs/ See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
Richard W.M. Jones
2010-Apr-17 08:38 UTC
[Libguestfs] Should umask takes effect when we create device file via mknod?
See also: http://git.annexia.org/?p=libguestfs.git;a=blob;f=daemon/mknod.c;h=50865a62664ffe41a0d8ab672785b5420fd1da14;hb=HEAD#l55 Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v
Apparently Analagous Threads
- permanently add md device
- rsync backups on Mac OS X - mknod errors + icon disappears...
- [Bug 1804] FreeBSD's mknod can't create FIFOs and sockets
- DO NOT REPLY [Bug 6280] New: (Bug incl. PATCH) Linux mknod does not work when syncing fifos and sockets from Solaris
- Mknod: Operation not permitted