Re: how to get /sbin/fuser results from apache php script?

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

 





On Sat, Nov 21, 2009 at 17:23, Donald Russell <russell.don@xxxxxxxxx> wrote:
I have a PHP web page that builds a list of files from a particular directory.

In that PHP script I want to include some information about "what is using the file" (i.e ftp, gzip, cp etc.. so I code

exec('/sbin/fuser -v $fpath/$fname',$answer,$retcode);

Retcode is always 1 (not in use, or a "fatal error" happened) and $answer is always empty

From root, in the directory I'm  interested in I use fuser -v * and it shows me a couple of in-use items
(for testing I have a little loop that gzip/gunzip a rather large file)

I tried /sbin/fuser from my own id and get the same results as apache... that is, nothing useful.

So I thought AH HA!, use sudo in the PHP script...
I got an error message from sudo saying a tty is required to use sudo even though I had that command set up to not require password.

Back to the drawing board...

How can I issue a command from a PHP script that will "run as root" to get the fuser results for me?

In some cases the file are chmod 600 root root in other cases 644 <regular user> <regular user>

I want my web page thing to show me the files in-use... I can live without the 600 root-root files, but I really need to see the others.

Any suggestions?

Thank very much.


Solution:

$ chmod 6755 /sbin/fuser

I'm not sure that's a really good idea.... but it gets the job done pretty nicely.

I don't think that introduces any problems... only the program/command name is shown when using the -v option...

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux