AIX 5L Basics (Unit 06) – File Permissions

Permissions String:
—————————–
-rwxrwxrwx

-(File ‘-‘/Directory ‘d’) rwx(Owner) rwx(Group) rwx(Others)

r = read, w = write, x = execute

Directory Permissions: (Default drwxr-xr-x or 755)
———————————
r – Can look at files in the directory
w – Can create or remove files (x is also needed)
x – Has permission to be in the directory (can cd to the directory or access files from the directory)

File Permissions: (Default -rw-r–r– or 644)
————————–
r – Can look at contents of the file
w – can change contents or delete the file
x – can use the file as a command (r is also needed)

Note: AIX checks the permissions of directories before checking permissions of the files.

Changing Permissions:
——————————–
chmod -go+w filename (Symbolic)
chmod 664 filename (Octal)

Symbolic Symbols:
—————————-
u – owner of file
g = owner’s group
o = others
a = all

+ add permissions
– remove permissions
= clear permissions

Octal Values:
——————–
r = 4, w = 2, x = 1
rwx = 4 + 2 + 1 = 7
rw- = 4 + 2 + 0 = 6
r– = 4 + 0 + 0 = 4
r-x = 4 + 0 + 1 = 5

Umask Value: (Default 022)
———————
umask location – /etc/security/user
umask – is used to remove permissions not to add permssions

Note: The umask value will temporarily change the default permissions unless it is added to the .profile for the user.

Directories:
777-022: 755 => rwxr-xr-x

New Files:
666-022: 644 => rw-r–r–

Note: The umask value is not subtracted from the permissions but disables the corresponding permission. In the above case the umask disables the w-write permissions for both the group and others.

Example:
umask 077 – This would change the umask value during my current login session. Any new files create would not have any permissions for the group or others.

Functions/Permissions Required:
————————————————-
Command Source Directory Source File Target Directory
————— ———————— —————– ———————–
cd x n/a n/a
ls r n/a n/a
ls -l r, x n/a n/a
mkdir x, w (parent) n/a n/a
rmdir x, w (parent) n/a n/a
——————————————————————————————-
cat, pg, more x r n/a
mv x, w none x, w
cp x r x, w
touch x, w none n/a
rm x, w none n/a
——————————————————————————————-

Leave a Reply

Your email address will not be published. Required fields are marked *

*