Previous Page | Next Page

  1. Agustin's Linux Manual
  2. System Administration
  3. About the Author
  4. Contents
  5. Administration
  6. Terminals
  7. Command Basics
  8. Root Directory
  9. Executing Commands
  10. File specs
  11. File Permission
  12. How permissions are assigned
  13. Change ownership chown
  14. Running multiple commands
  15. Killing Processes
  16. Bash configuration files
  17. VI Editor
  18. Creating path environment
  19. Midnight Commander
  20. Linuxconf Utility
  21. Networking
  22. Domain Name Service DNS
  23. Router and Gateway
  24. Adding Users
  25. User Accounts
  26. Managing Groups
  27. Mounting File System
  28. NFS Mounts
  29. Disk Quotas
  30. Run levels
  31. Linuxconf Control
  32. Mandrake Control Center
  33. Creating a Boot Disk
  34. Switching Boot Mode
  35. Hardware Configurations
  36. Printer Configuration
  37. Installing Printers
  38. Samba Printer
  39. Managing services
  40. Managing Users
  41. Program Scheduler
  42. Software Management
  43. Installing CUPS

File permission with chmod

The chmod command is used to give and set file permissions

Syntax 
	Chmod [permissions] filenames

Permissions: Specifies what rights are you granting

Filenames: File or directory to which you are assigning the permissions.
When you start granting permissions, you might opt for any of the following options: letters or numerical (I prefer numerical).

Permissions that you can grant:

By letterNumerical
UUser who owns the file400      Read by owner
ggroup that owns the file  040Read by group
oOther004Read by others
aAll200Write by owner
rReadable file020Write by group
wWriteable file002Write by others
x          Executable file100Execute by owner
  010Execute by group
  001Execute by others      
Table 3.2

There is something else that we need to understand before we can actually give permissions. First we have to know what type of permissions we are granting, and to whom it will be granted.

User IDS and Group IDS UID/GID

Under the UNIX operating system, every user is member of a group by default when you create a new user that user is member of its own group or member of users. The administrator can make specific users be part of any other group. Keep in mind that when the system executes or does something under a user name, that system does not actually see that user name, instead it sees just a user ID.

  • user ID stands as a number
  • A user name stands as a string and it is associated to the ID number

This is exactly the same for groups:

  • A group ID is a number
  • A group name is a string associated to the group ID number.