Pages

AIX File & Folder Ownership

Every file or folder in AIX has three key players:
  • Owner (user) – The user who created the file.
  • Group – Users who share access to the file.
  • Others – Everyone else.
Permissions define what each category can read, write, or execute. Master these, and you’ll tame any AIX filesystem.

Permission Basics: Read, Write, Execute
Permissions come in three flavors for each category (owner, group, others):

Permission Meaning
PermissionMeaning
Read (r)View file or list folder contents
Write (w)Modify file or add/delete in folder
Execute (x)Run file (if program) or enter folder

Check file permissions using:
# ls -l filename
Example output:
-rwxr-xr--
  • - = File type (d for directory)
  • rwx = Owner: full access
  • r-x = Group: read/execute, no write
  • r-- = Others: read-only
Changing Permissions with chmod
You can tweak file access in two modes:
Symbolic Mode (Easy Adds/Removes)
Letters represent categories:
  • u = owner
  • g = group
  • o = others
  • a = all
Examples:
# chmod u+r filename # Owner gains read permission
# chmod g-w filename # Group loses write permission
# chmod o+x filename # Others gain execute permission

Numeric (Octal) Mode

Assign numbers:

  • Read = 4
  • Write = 2
  • Execute = 1
Add them up for each category:

NumberPermissionsMeaning
7rwxFull access
6rw-Read + write
5r-xRead + execute
4r--Read only

Example:
# chmod 755 filename
  • Owner = 7 (rwx)
  • Group = 5 (r-x)
  • Others = 5 (r-x)
Perfect for scripts and executable files.

Ownership: chown and chgrp
Files can change ownership if you’re root:
# chown newuser filename # Change file owner
# chgrp newgroup filename # Change file group

Special Permissions:
AIX has advanced flags to control behavior:
  • Setuid (s): Runs the file as the file owner instead of the caller. Example: rwsr-xr-x
  • Setgid (s): New files inherit the folder’s group.
  • Sticky bit (t): Only the owner can delete a file in the directory. Common in /tmp:
drwxrwxrwt 14 root system 4096 Sep 26 12:00 /tmp
That t keeps your temp files safe from accidental deletion by others.

Hidden Files: 
Files starting with a dot (.) are hidden—ideal for configuration files like .bashrc or .ssh/.
# ls -l → skips hidden files
# ls -la → shows all files, including hidden ones

Example:
-rw-r--r-- 1 user group 123 Sep 26 12:00 file.txt
-rw-r--r-- 1 user group 50 Sep 26 12:05 .hiddenfile

Why hide?
  • Prevent accidental modifications
  • Keep configuration files safe
  • Permissions still apply (e.g., chmod 600 .hiddenfile = owner-only read/write)
Quick Hidden File Actions
# touch .myhiddenfile # Create a hidden file
# echo "Hello" > .myhiddenfile
# cd .ssh # Enter a hidden directory
# rm .hiddenfile # Delete hidden file

No comments:

Post a Comment