LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-14-2012, 04:04 PM   #1
Alligator42
LQ Newbie
 
Registered: Sep 2012
Posts: 8

Rep: Reputation: Disabled
Setting permissions for web user to allow exec command


I'd like to run the following command from a PHP file, and I'm having trouble. The command is not running, and I'm guessing it is due to permissions for the web user.

Code:
<?php  {
        exec('festival --tts test.txt');
    }
?>
The test.txt file is in the same directory as the PHP file, and I know it can see it. It just doesn't run the command. Why?
 
Old 09-14-2012, 04:29 PM   #2
KinnowGrower
Member
 
Registered: May 2008
Location: Toronto
Distribution: Centos && Debian
Posts: 347

Rep: Reputation: 34
1. Show the permission for the file
2. You can try by giving the absolute path for file

Last edited by KinnowGrower; 09-14-2012 at 04:30 PM.
 
Old 09-14-2012, 05:00 PM   #3
Alligator42
LQ Newbie
 
Registered: Sep 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
I changed the permissions of the test.txt file by typing:

sudo chmod 755 test.txt

I don't know where the festival file is, so I don't know the permissions.

Yes, I can run it when I'm logged into the machine - but isn't this different from when it is executed from a PHP web page?

I also tried the absolute path of the test.txt file, and that didn't work. i.e. /var/www/test.txt

I even tried editing sudoers to include this, and it didn't work:
apache ALL=NOPASSWD: /etc/festival

Last edited by Alligator42; 09-14-2012 at 05:13 PM.
 
Old 09-15-2012, 08:14 AM   #4
Alligator42
LQ Newbie
 
Registered: Sep 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
I figured out that the command is trying to be run as "nobody". How do I give permissions to "nobody" to allow this to be run?
 
Old 09-15-2012, 02:49 PM   #5
KinnowGrower
Member
 
Registered: May 2008
Location: Toronto
Distribution: Centos && Debian
Posts: 347

Rep: Reputation: 34
you can change the ownership of a file with the command

syntax of command is
Code:
chown owner:group filename
Code:
chown nobody:nobody test.txt
Now file test.txt has owner nobody and group-owner is also nobody
 
  


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
Setting Permissions for UGO in One Command Niall26 Linux - Newbie 3 05-20-2011 02:01 PM
exec(), crontab and web permissions va1damar Linux - Newbie 1 02-21-2007 04:55 PM
Setting permissions as user with nice? NightSoul Linux - Software 1 06-09-2006 12:01 PM
Setting user permissions PeteWieland Linux - Newbie 2 04-16-2005 06:35 AM
Setting User Permissions anon111 Linux - Newbie 3 04-12-2005 10:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:39 AM.

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