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

Change ownership chown

As I already mentioned earlier, the owner is the file's creator; therefore, the file is owned by a user and the user is owned by a group. This basically means the file is also owned by the group. A regular user is not able to take ownership of a file created by a different user, but the administrator (root) can and there after can reassign permissions.

This is much simpler; all you have to do is be root

[root@server2 collections]# chown user1 afile
[root@server2 collections]#ls l
total
rw-r--r--1 user1root6       Aug 1709:09 afile
-rw-r--r--1 rootroot27      Aug 1709:46 file2
-rw-r-- r--1 rootroot14      Aug 1709:46 myfile
drwxr-xr-x2 rootroot4096    Aug 17 10:34 another/

[root@server2 collections]#

As you can see the new owner now is user1, even though user1 belongs to group root.

How can you change the group?

Look at the following example

I will add user1 to group user1:

root@server2 collections]#chown user1.user1 afile

Now I will do the ls l

[root@server2 collections]#ls l total
rw-r--r--1 user1user16       Aug 1709:09 afile
-rw-r--r--1 rootroot27      Aug 1709:46 file2
-rw-r-- r--1 rootroot14      Aug 1709:46 myfile
drwxr-xr-x2 rootroot4096    Aug 1710:34 another/

[root@server2 collections]#

Now afile belongs to User1, User1 can now do anything to the file.

Note: An owner can be from any group, and still can have full control of the specified file if proper permission is granted.