1

I have to load a few additionals modules. One of them generates /dev/knem file. I have to set the permission to 0666, so a basic chmod 0666 /dev/knem works, but I would like to assign it directly at boot time.

Where shall I write the config so that it is directly set by the kernel when it loads the module?

Thanks in advance

  • Giving everyone read/write access to /dev/kmem is really bad from security perspective. If you want to give some software permissions to read/write to kernel memory, you should run the software as user that belongs to the appropriate group. – Tero Kilkanen Apr 29 '14 at 16:29
  • mmh, how do you do that in practice? Because each user will have to run MPI processes on other machines. Or is it enough to give permission to SLURM user only, as it is the scheduler? But I think the processes are executed in userspace, and MPI requires the kernel memory when running with infiniband... (as far as I know, I may have misunderstood what I have read until now). – Danduk82 Apr 29 '14 at 16:42
  • Ho yes: I'm setting a small HPC cluster for our working group in the lab... – Danduk82 Apr 29 '14 at 16:42
2

I might be wrong, but can't you use udev rules, to assign 0666 permissions when /dev/knem is mounted ?

http://www.reactivated.net/writing_udev_rules.html#syntax

Controlling permissions and ownership

udev allows you to use additional assignments in rules to control ownership and permission attributes on each device.

The GROUP assignment allows you to define which Unix group should own the device node. Here is an example rule which defines that the video group will own the framebuffer devices:

    KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video"

The OWNER key, perhaps less useful, allows you to define which Unix user should have ownership permissions on the device node. Assuming the slightly odd situation where you would want john to own your floppy devices, you could use:

    KERNEL=="fd[0-9]*", OWNER="john"

udev defaults to creating nodes with Unix permissions of 0660 (read/write to owner and group). If you need to, you can override these defaults on certain devices using rules including the MODE assignment. As an example, the following rule defines that the inotify node shall be readable and writable to everyone:

    KERNEL=="inotify", NAME="misc/%k", SYMLINK+="%k", MODE="0666"

A step-by-step on creting UDEV rules can be found in this post: http://ubuntuforums.org/showthread.php?t=168221

|improve this answer|||||
  • Thanks a lot, I added one udev rule for knem: KERNEL=="knem", NAME="knem", MODE="0666" and it works well. – Danduk82 Apr 29 '14 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.