Place Holder Products Code
Bash MySQL
Notes Return of the Fed Login
Admin Control Panel Email Control Panel Product Control Panel Debug Info Beacon Create Snippet Tag Control Panel

Test if a Specific User Can Access a Location

Verify your assumptions about file permissions by testing them!

www-data comes to mind.  Will Apache be able to read that folder?

sudo -u <user> test -r </location/to/test>

sudo's -u allows you to specify a specific user (instead of the usual root).  Then run test -r which determines if the passed file exists and can be read.

NB. If your terminal isn't setup to display return codes then you can run the following (example with www-data):

sudo -u www-data test -r /var/data; echo $?

$? holds whatever the last command returned.  Generally, 0 => Success,  Not 0 => Failure.

Comments:

No Comments Yet!