Find the answer to your Linux question:
Results 1 to 3 of 3
I have a device (a wireless/mobile robot) that is currently owned by root. I want it to be owned by a user. So, I type in: chown (user) (name of ...
  1. #1
    Just Joined!
    Join Date
    Sep 2008
    Posts
    2

    chown and saving it

    I have a device (a wireless/mobile robot) that is currently owned by root. I want it to be owned by a user.
    So, I type in:
    chown (user) (name of robot)

    And lo! It changes the robot's owner to be the new user.
    However, when I reboot the machine (I'm running SuSe development 10) it goes back to root! What's up with that?!

  2. #2
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    Files in /dev are generated and managed by the kernel. They're not like ordinary files, and they may or may not actually have any sort of disk presence. So you can't rely on changes that you make to still exist.

    If you know that you always want to chown that file to a user, I suggest writing an init script. init scripts run when the OS boots, and they're pretty simple. You can find a guide for SuSE at:
    Cool Solutions: Creating Custom init Scripts

    It's a bit old, but hopefully it still works (I don't run SuSE, so I can't test it). But even if it's a bit off, the description is still pretty valuable: write an init script, add it to a runlevel, and there you go!
    DISTRO=Arch
    Registered Linux User #388732

  3. #3
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Actually, strictly speaking those files/nodes are generated nowadays using udev on most distros (unless your distro of choice is still using an static /dev filesystem, which seems not to be the case since the perms are not preserved). In the past few years, most distros used a static /dev, but instead of creating it manually, scripts like hotplug and coldplug were used to manage the creation and removal of device nodes.

    So, since udev is the one that's doing it, it seems most natural to me to create / modify the matching udev rule to adjust the permissions. This is not the most natural way around it, but it also guarantees that if the node has to be recreated by any reason while the pc is on, you will still have the right permissions.

    Udev rules are under /etc/udev/rules.d/, and this is all you need to know: Writing udev rules

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...