Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
phpmyadmin, chmod, chown, etc.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
cazort
Guru
Guru


Joined: 19 Sep 2004
Posts: 343
Location: Lancaster, PA

PostPosted: Fri Nov 12, 2004 8:08 pm    Post subject: phpmyadmin, chmod, chown, etc. Reply with quote

I have had phpmyadmin working. The thing is, I want to make it so that only apache (and root) can access the directory. I tried chown and chgrping everything in the directory to be such that only apache could read the files in the directory...but now I can't access phpmyadmin.

What am I doing wrong?

drw-rw---- 7 apache apache 3056 Nov 12 14:30 phpmyadmin/

With everything in the directory having the same privileges...why isn't this working?
Back to top
View user's profile Send private message
db_404
Guru
Guru


Joined: 05 Dec 2002
Posts: 336

PostPosted: Fri Nov 12, 2004 8:14 pm    Post subject: Reply with quote

You don't have the execute bit set on the directory, try chmod 770 phpmyadmin and see if that works (oh, and you'll need to do the same to any subdirectories as well).
Back to top
View user's profile Send private message
cazort
Guru
Guru


Joined: 19 Sep 2004
Posts: 343
Location: Lancaster, PA

PostPosted: Fri Nov 12, 2004 8:31 pm    Post subject: Reply with quote

Nope, this still gives permission denied when I try to access the webpage.
Back to top
View user's profile Send private message
db_404
Guru
Guru


Joined: 05 Dec 2002
Posts: 336

PostPosted: Sat Nov 13, 2004 2:20 am    Post subject: Reply with quote

Do a ls -ld phpmyadmin in the web root
And a ls -l in phpmyadmin

Mine are:
Code:

$ ls -ld phpmyadmin/
drwxr-xr-x  7 root root 3024 Nov 12 20:17 phpmyadmin/

Code:

$ ls -l
total 1454
-rw-r--r--  2 root root 166250 Oct 21 20:25 Documentation.html
-rw-r--r--  2 root root     29 Oct 21 20:25 RELEASE-DATE-2.6.0-pl2
-rw-r--r--  2 root root   9406 Oct 21 20:25 browse_foreigners.php
-rw-r--r--  2 root root   3155 Oct 21 20:25 calendar.php
-rw-r--r--  2 root root    236 Oct 21 20:25 changelog.php
-rw-r--r--  2 root root    475 Oct 21 20:25 chk_rel.php
-rw-r--r--  2 root root  37880 Oct 21 20:25 config.default.php
-rw-r--r--  2 root root    132 Oct 21 20:25 config.footer.inc.php
-rw-r--r--  2 root root    132 Oct 21 20:25 config.header.inc.php
-rw-r--r--  1 root root  38365 Oct 23 12:40 config.inc.php
-rw-r--r--  2 root root  37880 Oct 21 20:25 config.inc.php.orig
drwxr-xr-x  2 root root     88 Oct 21 20:26 css
-rw-r--r--  2 root root   1228 Oct 21 20:25 db_create.php
-rw-r--r--  2 root root   9944 Oct 21 20:25 db_datadict.php
-rw-r--r--  2 root root  13253 Oct 21 20:25 db_details.php
-rw-r--r--  2 root root   2973 Oct 21 20:25 db_details_common.php
-rw-r--r--  2 root root   5226 Oct 21 20:25 db_details_db_info.php
-rw-r--r--  2 root root   1924 Oct 21 20:25 db_details_export.php
-rw-r--r--  2 root root  13259 Oct 21 20:25 db_details_importdocsql.php
-rw-r--r--  2 root root   3971 Oct 21 20:25 db_details_links.php
-rw-r--r--  2 root root  37324 Oct 21 20:25 db_details_qbe.php
-rw-r--r--  2 root root  42455 Oct 21 20:25 db_details_structure.php
-rw-r--r--  2 root root  10476 Oct 21 20:25 db_printview.php
-rw-r--r--  2 root root  14757 Oct 21 20:25 db_search.php
-rw-r--r--  2 root root   2817 Oct 21 20:25 docs.css
-rw-r--r--  2 root root  21601 Oct 21 20:25 export.php
-rw-r--r--  2 root root   7700 Oct 21 20:25 footer.inc.php
-rw-r--r--  2 root root   9356 Oct 21 20:25 header.inc.php
-rw-r--r--  2 root root   2552 Oct 21 20:25 header_printview.inc.php
-rw-r--r--  2 root root   7279 Oct 21 20:25 index.php
drwxr-xr-x  2 root root   4816 Oct 21 20:27 lang
-rw-r--r--  2 root root   5517 Oct 21 20:25 ldi_check.php
-rw-r--r--  2 root root   7555 Oct 21 20:25 ldi_table.php
-rw-r--r--  2 root root  43805 Oct 21 20:25 left.php
drwxr-xr-x  8 root root   1752 Oct 21 20:27 libraries
-rw-r--r--  2 root root  30362 Oct 21 20:25 main.php
..etc.etc.etc


Also I'm asusming your 'permission denied' error is from Apache, not the login failed message from phpmyadmin.
Back to top
View user's profile Send private message
kentsin
n00b
n00b


Joined: 08 Dec 2002
Posts: 58
Location: Macao

PostPosted: Sat Nov 13, 2004 6:49 pm    Post subject: Reply with quote

I have the same problem, after I chown apache:apache *
chmod u+x *.php

I can access.

However, Is that OK?

Why is emerge write file in /var/www/localhost/htdocs/... as root:root and with wrong mode?
Back to top
View user's profile Send private message
cazort
Guru
Guru


Joined: 19 Sep 2004
Posts: 343
Location: Lancaster, PA

PostPosted: Mon Nov 15, 2004 2:34 pm    Post subject: Reply with quote

db404: if I set the permissions to the way you have yours, it works. The problem is, I don't want those permissions. I don't want everyone to be able to read that directory.

There is a (not necessarily gaping) security hole in the way your file is set up which is that config.inc.php is readable by anyone. This is not generally a good idea.

I basically changed the ownership of the directory and all files in it to the apache user/group. The thing is...when I remove readable access for anyone, it fails on me.

I want to make it so that only root and the apache user can read this directory; I don't want anyone else to even be able to see the contents of the directory.
Back to top
View user's profile Send private message
db_404
Guru
Guru


Joined: 05 Dec 2002
Posts: 336

PostPosted: Mon Nov 15, 2004 3:14 pm    Post subject: Reply with quote

cazort wrote:
db404:
I basically changed the ownership of the directory and all files in it to the apache user/group. The thing is...when I remove readable access for anyone, it fails on me.


OK, I tried it on my box - this seems to work:

Basically did chown -R apache:apache phpmyadmin
and chmod o-r -R phpmyadmin
and chmod o-x -R phpmyadmin

Code:

# ls -ld phpmyadmin
drwxr-x---  7 apache apache 3024 Nov 12 20:17 phpmyadmin


and
Code:

# ls -l phpmyadmin
total 1454
-rw-r-----  2 apache apache 166250 Oct 21 20:25 Documentation.html
-rw-r-----  2 apache apache     29 Oct 21 20:25 RELEASE-DATE-2.6.0-pl2
-rw-r-----  2 apache apache   9406 Oct 21 20:25 browse_foreigners.php
-rw-r-----  2 apache apache   3155 Oct 21 20:25 calendar.php
-rw-r-----  2 apache apache    236 Oct 21 20:25 changelog.php
-rw-r-----  2 apache apache    475 Oct 21 20:25 chk_rel.php
-rw-r-----  2 apache apache  37880 Oct 21 20:25 config.default.php
-rw-r-----  2 apache apache    132 Oct 21 20:25 config.footer.inc.php
-rw-r-----  2 apache apache    132 Oct 21 20:25 config.header.inc.php
-rw-r-----  1 apache apache  38365 Oct 23 12:40 config.inc.php
-rw-r-----  2 apache apache  37880 Oct 21 20:25 config.inc.php.orig
drwxr-x---  2 apache apache     88 Oct 21 20:26 css
-rw-r-----  2 apache apache   1228 Oct 21 20:25 db_create.php
-rw-r-----  2 apache apache   9944 Oct 21 20:25 db_datadict.php
-rw-r-----  2 apache apache  13253 Oct 21 20:25 db_details.php
-rw-r-----  2 apache apache   2973 Oct 21 20:25 db_details_common.php
-rw-r-----  2 apache apache   5226 Oct 21 20:25 db_details_db_info.php
-rw-r-----  2 apache apache   1924 Oct 21 20:25 db_details_export.php
-rw-r-----  2 apache apache  13259 Oct 21 20:25 db_details_importdocsql.php
-rw-r-----  2 apache apache   3971 Oct 21 20:25 db_details_links.php
-rw-r-----  2 apache apache  37324 Oct 21 20:25 db_details_qbe.php
-rw-r-----  2 apache apache  42455 Oct 21 20:25 db_details_structure.php
-rw-r-----  2 apache apache  10476 Oct 21 20:25 db_printview.php
-rw-r-----  2 apache apache  14757 Oct 21 20:25 db_search.php
-rw-r-----  2 apache apache   2817 Oct 21 20:25 docs.css
-rw-r-----  2 apache apache  21601 Oct 21 20:25 export.php
-rw-r-----  2 apache apache   7700 Oct 21 20:25 footer.inc.php
-rw-r-----  2 apache apache   9356 Oct 21 20:25 header.inc.php
-rw-r-----  2 apache apache   2552 Oct 21 20:25 header_printview.inc.php
-rw-r-----  2 apache apache   7279 Oct 21 20:25 index.php
drwxr-x---  2 apache apache   4816 Oct 21 20:27 lang
etc.etc.etc.
Back to top
View user's profile Send private message
cazort
Guru
Guru


Joined: 19 Sep 2004
Posts: 343
Location: Lancaster, PA

PostPosted: Mon Nov 15, 2004 5:10 pm    Post subject: Reply with quote

db_404 wrote:

OK, I tried it on my box - this seems to work:

Basically did chown -R apache:apache phpmyadmin
and chmod o-r -R phpmyadmin
and chmod o-x -R phpmyadmin


Thanks...this works perfectly! Not sure what I did wrong the first time...

:-)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum