LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 08-16-2005, 07:40 AM   #1
RedCharlie
LQ Newbie
 
Registered: Jul 2003
Location: Arkansas
Distribution: Fedora, Ubuntu, CentOS
Posts: 26

Rep: Reputation: 15
can't permanently change /dev/loop* permissions


I use the loopback device to play dvd movie iso's, and for non-root users to be able to do so, I need to make all the loop device files world readable. I do this with chmod a+r /dev/loop* and it works fine. After a reboot, however, I find that I have the same problem again. Something has gone behind me and changed the /dev/loop permissions back to 640 from 644. I even stuck a "chmod a+r /dev/loop*" into my rc.local, but something still goes and changes the permissions back to 640, and by examining the timestamps from "ls -ltc /dev/loop*" it seems that whatever is doing this can be acting 30 min or so after boot.

I've disabled SELinux, so I don't think that is the problem.
 
Old 08-16-2005, 08:26 AM   #2
oneandoneis2
Senior Member
 
Registered: Nov 2003
Location: London, England
Distribution: Ubuntu
Posts: 1,460

Rep: Reputation: 48
I suspect you're using udev, which creates /dev entries dynamically. Check your /etc/udev rules and amend as appropriate
 
Old 08-16-2005, 08:34 AM   #3
satinet
Senior Member
 
Registered: Feb 2004
Location: England
Distribution: Slackware 14.2
Posts: 1,491

Rep: Reputation: 50
not sure where your specific udev rules live. probably in /etc/udev

in there cd to rules.d and edit the rules file. You'll find a section for loop back devices and you will be able to change the default permissions.,,.......
 
Old 08-16-2005, 08:39 AM   #4
oneandoneis2
Senior Member
 
Registered: Nov 2003
Location: London, England
Distribution: Ubuntu
Posts: 1,460

Rep: Reputation: 48
Unless you're using an older version, in which case you'd need to look at permissions.d
 
Old 08-19-2005, 10:25 AM   #5
RedCharlie
LQ Newbie
 
Registered: Jul 2003
Location: Arkansas
Distribution: Fedora, Ubuntu, CentOS
Posts: 26

Original Poster
Rep: Reputation: 15
Thanx for the suggestions. I am new to Fedora and udev, I would not have known to look there.

But I am having limited luck trying to modify the permissions for my loopback devices.

I've tried adding the line
KERNEL=="loop7", MODE="0644"

to both /etc/udev/rules.d/50-udev.rules (yes, I know I'm supposed to stick it in another file...)
and into 10-local.rules (my own file) with no effect

part of the problem may be that
...# udevinfo -q path -n /dev/loop7
spat out "no such device until I actually used losetup to setup an iso, afterwich it found all the loopback devices (setup or not)
..# udevinfo -q path -n /dev/loop7
/block/loop7

My main trouble is that the ONLY thing that has any effect is changing the line
SUBSYSTEM=="block", GROUP="disk", MODE="0640"
to
SUBSYSTEM=="block", GROUP="disk", MODE="0644"
in /etc/udev/rules.d/50-udev.rules

but this changes ALL my block devs to 0644 (not an issue with me, but I don't know the full ramifications of that, at the very least it could make the swap partition world readable, which is security hole)

I've tried the following lines, both in 50-udev.rules and in 10-local.rules, then either run "udevstart" or just rebooted, but again, nothing seems to have ANY effect except modifying the line above.
SUBSYSTEM=="block", SYSFS{dev}=="7:7", GROUP="disk", MODE="0644"
KERNEL=="loop7", GROUP="disk", MODE="0644"

So, any suggestions would be greatly appreciated.
oh, yeah, once udevinfo found my loopbacks, this is sample output

# udevinfo -a -p /block/loop7
udevinfo starts with the device the node belongs to and then walks up the
device chain, to print for every device found, all possibly useful attributes
in the udev key format.
Only attributes within one device section may be used together in one rule,
to match the device for which the node will be created.

device '/sys/block/loop7' has major:minor 7:7
looking at class device '/sys/block/loop7':
SUBSYSTEM=="block"
SYSFS{dev}=="7:7"
SYSFS{range}=="1"
SYSFS{removable}=="0"
SYSFS{size}=="0"
SYSFS{stat}==" 0 0 0 0 0 0 0 0 0 0 0"
 
Old 11-10-2006, 06:18 PM   #6
RedCharlie
LQ Newbie
 
Registered: Jul 2003
Location: Arkansas
Distribution: Fedora, Ubuntu, CentOS
Posts: 26

Original Poster
Rep: Reputation: 15
Lightbulb fixed (well, I have some options now...)

I'm not sure that udev has much to do with it...
I'm running FC5 now, and looking thru /etc/udev/rules.d/50-default.rules
Code:
# skip rules for inappropriate block devices
KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end"
and if I try looking for a loop device...
Code:
[root@k7som-5c rules.d]# udevinfo -q path -n /dev/loop7
no record for 'loop7' in database
[root@k7som-5c rules.d]# udevtest loop7
main: unable to open 'loop7'
But since I first struggled with this, I have discovered /etc/security/console.perms and
/etc/security/console.perm.d/50-default.perms
The latter contains rules which give ownership of various devices, especially removable media, to any user logged into the console(tty or X session)

I added this rule (to 50-default.perms) to give ownership of /dev/loop7 to the console user, and set the default (no user at console) to mode 0644:
Code:
<console>  0640 <loop>       0644 root.disk
and voila! /dev/loop7 was mode 0664 (no user at console, I'm logged in via VNC, doesn't count ;-)

Now all I need to do is figure out how to tell pam to scr8w the console user and just set the device to mode 0644 all the time...
 
Old 07-21-2010, 05:03 AM   #7
an4linux
LQ Newbie
 
Registered: Jul 2010
Posts: 1

Rep: Reputation: 0
Thumbs up Rule to change loop permission

Quote:
Originally Posted by RedCharlie View Post
I'm not sure that udev has much to do with it...
I'm running FC5 now, and looking thru /etc/udev/rules.d/50-default.rules
Code:
# skip rules for inappropriate block devices
KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end"
and if I try looking for a loop device...
SUBSYSTEM=="block", KERNEL=="loop[0-9]", MODE="0666"

Will change loop mode accordingly

Thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't permanently change path SuperRunt Linux - Newbie 11 02-02-2005 11:59 PM
How can I change the permissions of /dev/ptyp* (chmod does not work) gderou Mandriva 0 08-24-2004 10:37 AM
How to permanently set permissions on all files created in a directory? BrianK Linux - General 8 06-24-2004 04:06 PM
Why do my directory permissions not stick permanently? h00chman Linux - Newbie 3 03-20-2004 05:49 PM
Permanently change the hostname juby Linux - Software 13 05-10-2003 12:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 11:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration