Thursday, August 6, 2009

Access Permission of the Underlying Directory BEFORE mount

In AIX 5.2, the du, find and tar command will sometimes fail in some directories. But, they can be run successfully in some other directories. Why this happens ? It is all because of the filesystem mounting.

It is very natural to mount numerous filesystems in AIX. Usually, a filesystem is mounted onto a directory of the same name in another filesystem. For example, under the ROOT filesystem, there are numerous other filesystems mounted onto many directories. When you ls these directories, you are actually getting the access permission of the AFTER-MOUNTED image. However, in AIX 5.2, the technical aspect of some commands such as find and tar will check the access permission of the BEFORE-MOUNTED directory. As a result, even the ls command reports a permission of 777 for the directory, the access permission of the BEFORE-MOUNTED underlying directory may have a permissoin of 700. Then, the find or tar command will certainly fail.

Since the ls command (and many other commands) will only reports the access permission of the AFTER-MONUTED image, how to know about the access permission of the before image ? The answer is to check the inode information. But, how to do so ?

First of all, you have to know the inode number. Supposed that your filesystem is mounted onto the directory /usr/your/directory. To search for the inode number of the underlying directory /usr/your/directory, issue this command:
ncheck | grep -e ':$' /usr/your/directory

The output may look like this:
: : /dev/hd1: 1996 /usr/God/directory 1997 /usr/your/directory 1998 /usr/others/directory : :

Then, use this command to check the access permission of the inode of the underlying directory:
istat 1997 /dev/hd1

You will certainly get the access perssions which is very different to that got from the ls command. This is the access permission of the underlying directory.



No comments:

Duplicate Open Current Folder in a New Window

Sometimes after I opened a folder in Win7, I would like to duplicate open the same folder again in another explorer window. Then, I can ope...