LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 10-05-2005, 01:15 AM   #1
baosheng
Member
 
Registered: Oct 2004
Location: Lubbock, TX, USA
Distribution: Ubuntu 7.10
Posts: 74

Rep: Reputation: 15
why "permission denied" though chmod 666?


I encountered a very strange problem today.
My PHP script can't open files whose privilege is 666.

Warning: fopen(./home_page/zzm.txt): failed to open stream: Permission denied in /www/index.php on line 294

Warning: fgets(): supplied argument is not a valid stream resource in /www/index.php on line 295

Warning: fclose(): supplied argument is not a valid stream resource in /www/index.php on line 297

Warning: fopen(./home_page/zzm.txt): failed to open stream: Permission denied in /www/index.php on line 298

Warning: fputs(): supplied argument is not a valid stream resource in /www/index.php on line 299

Warning: fclose(): supplied argument is not a valid stream resource in /www/index.php on line 300

Warning: fopen(./home_page/zzm2.txt): failed to open stream: Permission denied in /www/index.php on line 304

Warning: fputs(): supplied argument is not a valid stream resource in /www/index.php on line 305

Warning: fclose(): supplied argument is not a valid stream resource in /www/index.php on line 306

But their privilege is 666 now:
-rw-rw-rw- 1 root root 4484 May 24 21:38 zzm2.txt
-rw-rw-rw- 1 root root 1 May 21 21:29 zzm.txt


can any one help me?
 
Old 10-05-2005, 03:14 AM   #2
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
Can you open the file with vi?
You should check the access rights at the directory level and at the filesystem level.

PS : this is not a networking question.
 
Old 10-05-2005, 05:56 AM   #3
baosheng
Member
 
Registered: Oct 2004
Location: Lubbock, TX, USA
Distribution: Ubuntu 7.10
Posts: 74

Original Poster
Rep: Reputation: 15
yes.I can edit it via vi.And I am the root.
 
Old 10-05-2005, 06:39 AM   #4
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
Probably php security settings then...
I don't know much about php sorry. I hope someone will help, good luck.
 
Old 10-05-2005, 06:56 AM   #5
perfect_circle
Senior Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Slackware, arch
Posts: 1,783

Rep: Reputation: 52
What are the permissions in ./home_page ?
 
Old 10-08-2005, 02:41 AM   #6
baosheng
Member
 
Registered: Oct 2004
Location: Lubbock, TX, USA
Distribution: Ubuntu 7.10
Posts: 74

Original Poster
Rep: Reputation: 15
666
 
Old 10-08-2005, 03:48 AM   #7
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 48
Make sure the enclosing directories are 755 or 711 or something like that. You need execute permission (the "1" bit) to access the contents of a directory.
 
Old 10-09-2005, 11:25 PM   #8
baosheng
Member
 
Registered: Oct 2004
Location: Lubbock, TX, USA
Distribution: Ubuntu 7.10
Posts: 74

Original Poster
Rep: Reputation: 15
I am puzzled.
What is the difference between r and x,if x is need to access the directory?
 
Old 10-10-2005, 12:52 AM   #9
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,066

Rep: Reputation: 295Reputation: 295Reputation: 295
On a directory, read permissions let you see what files are in that directory, and execute permissions allow you to change into that dirtectory.
 
Old 10-10-2005, 12:33 PM   #10
perfect_circle
Senior Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Slackware, arch
Posts: 1,783

Rep: Reputation: 52
Permission in directories:

read: being able to read the context of a directory (doing ls on the directory)
write being able to write a file in the directory
execute being able to enter in the directory (with cd) (write and read have no point without execute).

Last edited by perfect_circle; 10-10-2005 at 12:34 PM.
 
Old 10-10-2005, 10:50 PM   #11
baosheng
Member
 
Registered: Oct 2004
Location: Lubbock, TX, USA
Distribution: Ubuntu 7.10
Posts: 74

Original Poster
Rep: Reputation: 15
oh i see
I assume x means run a binary file or shell script

and now I use

chmod a+x /my/directory -R

and it's ok

but I can't use

chmod 666 /my/directory -R

to enable http access to /my/directory

it's funny

Last edited by baosheng; 10-10-2005 at 10:52 PM.
 
Old 10-10-2005, 11:38 PM   #12
deepclutch
Member
 
Registered: Nov 2004
Distribution: Debian Testing+Sid
Posts: 694
Blog Entries: 1

Rep: Reputation: 32
Post

check the attributes with 'lsattrib' command
 
Old 10-10-2005, 11:40 PM   #13
dhruvypatel
Member
 
Registered: Oct 2005
Location: Bangalore,India
Distribution: Debian
Posts: 37

Rep: Reputation: 15
What you can do is just disable SElinux option and try. This might solve your problem. To disable SElinux do:

press ALT+F2. In dialog box write system-config-security and press enter. In security dialog box disable SElinux option. and reboot.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 execute c++ binaries, "permission denied"... even though permission is 777 SerfurJ Programming 14 02-20-2009 04:50 AM
Submount, "permission denied" when writing to floppy as normal user DaneM Linux - Software 5 02-22-2006 02:05 PM
Only root hears sounds, alsa gives "permission denied" Baix Linux - General 4 07-02-2005 01:30 PM
Eclipse SDK v3.0 running problem: "Permission denied" AlexDunnCpp Linux - Newbie 1 08-03-2004 11:45 AM
"permission denied" when I try to send raw data to the sound device. Travis86 Linux - Hardware 2 10-29-2003 09:08 AM


All times are GMT -5. The time now is 12:35 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration