Check Access Permissions /* * check_access - check if the user has read permission to a * given file. If not, check where the problem lies. * * Background: In order to read from a file, we must have * execute permission in all directories leading * to this file, as well as read access to the * file itself. For example, to read from file * "/etc/config/blabla.conf", we must have X * permission on '/etc' and on '/etc/config', * as well as R permission on * "/etc/config/blabla.conf" itself. * * Algorithm: split the file path to its directories, make * sure the directory exists and that the user * has execute permission to all directories. * Finally check that the file exists, and that * the user has read permission to the file itself. */