Managing File and Directory Permissions

If you’re the administrator of the system, or if you can run the sudo command, you can change the permissions on files and directories anywhere on your system.

The files structure you made in your home directory is something other users on the machine could use, so let’s copy the structure into the /var directory so others can access it. Use the sudo command since you don’t have write access to the var directory:

 $ ​​sudo​​ ​​cp​​ ​​-r​​ ​​~/files​​ ​​/var/files

Next, get a long listing of the /var/files directory, showing all hidden files. This lets you view the permissions of the /var/files directory itself:

 $ ​​ls​​ ​​-alh​​ ​​/var/files
 total 32K
 drwxr-xr-x 8 root root 4.0K Mar 2 13:25 .

Get Small, Sharp Software Tools now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.