Unix systems support multiple users and concurrent tasks. Users can log in locally or remotely via SSH. Graphical interfaces can even be displayed remotely using the X Window System. This multiuser architecture stems from Unix's roots in shared academic computing.
Each file in Unix is assigned:
id
# uid=500(me) gid=500(me) groups=500(me)
User, group, and shadow information are stored in /etc/passwd
, /etc/group
, and /etc/shadow
.
Indicator | File Type |
---|---|
- | Regular file |
d | Directory |
l | Symbolic link |
c | Character device |
b | Block device |
-rw-rw-r-- 1 me me 0 foo.txt
Interpretation: owner and group have read/write access; others have read-only access.
Permissions can be changed using:
chmod 600 foo.txt
chmod u+x script.sh
chmod 600 foo.txt
chmod u+x script.sh
chmod g+w shared.txt
The umask
subtracts from default base permissions:
umask 0002
# Results in: -rw-rw-r--
Bit | Description | Example |
---|---|---|
Setuid (4000) | Run with owner’s privileges | -rwsr-xr-x |
Setgid (2000) | Preserve group in sub-files | drwxrwsr-x |
Sticky bit (1000) | Restrict deletion to owners | drwxrwxrwt |
chmod g+s shared_dir
chmod +t public_dir
/etc/sudoers
configsudo backup_script
Note: Ubuntu disables root account by default, preferring sudo access.
sudo chown tony: file.txt # Change user to tony
sudo chgrp music file.mp3 # Change group to 'music'
music
/usr/local/share/Music
sudo chown :music /usr/local/share/Music
sudo chmod 775 /usr/local/share/Music
sudo chmod g+s /usr/local/share/Music
Ensure umask 0002
to allow group write access.
passwd # Change current user password
sudo passwd username # Change another user's password
Changes are stored in /etc/shadow
and follow system policies.
Unix’s permission system enables reliable multiuser environments. With tools like chmod
, umask
, sudo
, chown
, and passwd
, administrators and users can customize access and ownership for secure resource sharing.