Linux noobie here, I'm still figuring things out as I move along. At my school we have a shared server environment where every student gets an account. But we have very limited permissions.
I have a webpage that requires mysql access, its a PHP page. I currently store the mysql login information in a text file. I store this information outside of my public_html directory, inside my home directory.
My webpages basically work in this fashion: It attempt to read the password file and then connects to mysql from there, throwing an error if it fails to read it.
This works only if I set the permissions of the password file to be 777.
This technically works, but I know its wrong as another student can just navigate to the file locally and discover my password. As a student project its probably not a big deal, but I can't get away with this in the real world.
If I change the permissions of the file, apache can't get at it.
I was using this topic to troubleshoot
What are the best linux permissions to use for my website?
but I seem to be more restricted than this person.
1) I have no permission to chgrp, chown, or setfacl
Actually I'm not 100% sure on setfacl as I've never used this command before
setfacl -m g:daemon:r passwordfile.txt
setfacl: /somegenericpath/passwordfile.txt: Operation not supported
2) I'm not exactly sure if daemon is the right group, I'm looking for. The guide said the default is typically www-data, and using the command ps aux | grep httpd, to find it, but all I'm finding is daemon and root.
[me@someserver~]$ ps aux | grep httpd
root 3209 0.0 0.2 186972 11392 ? Ss Jun13 0:00 /usr/local/apache/bin/httpd -k start
daemon 5353 0.0 0.2 187104 11200 ? S Aug02 0:00 /usr/local/apache/bin/httpd -k start
daemon 5354 0.0 0.2 186972 10080 ? S Aug02 0:00 /usr/local/apache/bin/httpd -k start
daemon 10220 0.0 0.2 186972 10136 ? S Jul30 0:00 /usr/local/apache/bin/httpd -k start
daemon 10221 0.0 0.2 189172 11520 ? S Jul30 0:00 /usr/local/apache/bin/httpd -k start
daemon 13352 0.0 0.2 187104 11668 ? S Jul26 0:00 /usr/local/apache/bin/httpd -k start
daemon 22647 0.0 0.2 187104 11544 ? S Jul18 0:01 /usr/local/apache/bin/httpd -k start
daemon 25622 0.0 0.2 187104 11140 ? S Aug03 0:00 /usr/local/apache/bin/httpd -k start
daemon 26737 0.0 0.2 186972 9988 ? S Aug03 0:00 /usr/local/apache/bin/httpd -k start
daemon 26743 0.0 0.2 186972 9980 ? S Aug03 0:00 /usr/local/apache/bin/httpd -k start
me 27570 0.0 0.0 61204 764 pts/1 S+ 00:39 0:00 grep httpd
daemon 30187 0.0 0.2 187104 11528 ? S Jul31 0:00 /usr/local/apache/bin/httpd -k start
Heres some more server information.
Server version: Apache/2.2.16 (Unix)
Linux venus 2.6.18-308.8.2.el5 #1 SMP Tue Jun 12 09:58:12 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
core_module (static)
authn_file_module (static)
authn_default_module (static)
authz_host_module (static)
authz_groupfile_module (static)
authz_user_module (static)
authz_default_module (static)
auth_basic_module (static)
include_module (static)
filter_module (static)
log_config_module (static)
env_module (static)
setenvif_module (static)
version_module (static)
mpm_prefork_module (static)
http_module (static)
mime_module (static)
status_module (static)
autoindex_module (static)
asis_module (static)
cgi_module (static)
negotiation_module (static)
dir_module (static)
actions_module (static)
userdir_module (static)
alias_module (static)
so_module (static)
php5_module (shared)
Am I doing something completely wrong or is it impossible with my current set of privileges
Sidenote: Figuring out what commands, I'm allow to use, and which ones I'm banned from, is a real test of guess and check, Is there anyway to drum up a list of commands that I can/can't use? This ones a real pain to search, anytime list and command show up all the results are about ls.
chown daemon fileif file owned by you, you canchmod 0655 fileit will allow all users on the machine to read file, – eicto Aug 5 '12 at 0:48