On Tue, 2008-01-22 at 09:20 +0100, Zoltán Németh wrote:
> 2008. 01. 22, kedd keltezéssel 03.15-kor Robert Cummings ezt írta:
> > On Tue, 2008-01-22 at 09:10 +0100, Zoltán Németh wrote:
> > > 2008. 01. 21, hétfő keltezéssel 20.23-kor shiplu ezt írta:
> > > > I configured autofs in my fedora so that when I plug any usb stick in
> > > > /dev/sda1 it automatically mounts in /mnt/auto/usb0
> > > > 
> > > > There is two lines where the problem arise.
> > > > 
> > > > $util->run_command("ls -1 /mnt/auto/usb0 | wc -l");    // it shows 13 
> > > > when I
> > > > plug my usb stick.
> > > > $list = scandir("/mnt/auto/usb0 ");  // here $list is null
> > > > 
> > > > This script is in a php file which is running by apache.
> > > > the $util object is not actually running the command but it is 
> > > > inserting the
> > > > command in a queue. There is daemon who has root access processing the
> > > > queue.
> > > > It means the command in $util->run_command() is executing with root
> > > > privilege. this command mounts and get the total amount of file/folder 
> > > > very
> > > > nicely
> > > > But when I run the second line I see there is no file. How can I fill 
> > > > the
> > > > list with those file list.
> > > > It may look that the problem is regarding permission. But I don't think 
> > > > so.
> > > > Becasue I use the same command I mean the same 2 lines with /mnt/cdrom, 
> > > > and
> > > > it works very nicely
> > > > 
> > > > It works,
> > > > $util->run_command("ls -1 /mnt/cdrom | wc -l");    // it shows 200 in 
> > > > my CD
> > > > rom drive
> > > > $list = scandir("/mnt/cdrom");  // here I get full list of files/folders
> > > > 
> > > > Why its happening?
> > > 
> > > I'm pretty sure it is because of the permissions on the mounted usb
> > > stick. for example my ubuntu automounts my usb stick with permissions
> > > 700 and user/group as me. so it would not be accessible by any other
> > > user, except root. I think that's what happening in your case.
> > > 
> > > However, I do not know where you can set that up...
> > 
> > Doesn't the root directory of a mounted partition inherit the
> > ownership/permissions of the directory upon which it is mounted?
> 
> not if it is mounted with some umask and permissions and stuff specified
> for mount, I think.
> for example in the above case, my /media dir has permissions 755
> owner/group root/root, but when automount mounts my usb stick
> in /media/KINGSTON it becomes completely different

The ownership/permissions of /media are not important it's the actual
mountpoint that is important. In this case "KINGSTON" but that is
probably being dynamically created. In which case to control the
ownership/perms it may be necessary to configure the mount manually
versus relying on automount. I'd be interested to see what happens if he
creates /mnt/auto/usb0 with appropriate ownership/perms before plugging
in the device and letting automount mount it.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to