Re: scandir() in automount/autofs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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...

greets
Zoltán Németh

> 
> I want the $list to be filled. Also I need directory and file information so
> that I can make another list like
> array(array('Type'=>'DIR','Name'=>'music'),array('Type'=>'DIR','Name'=>'music1'),array('Type'=>'FIL','Name'=>'
> elvis.mp3'),array('Type'=>'FIL','Name'=>'elvis2.mp3'),...);
> 
> 

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux