From 34fad256dfac7f55aa4e519592f1683ecec6645a Mon Sep 17 00:00:00 2001 From: Jose Date: Fri, 2 Sep 2022 12:44:27 -0300 Subject: [PATCH] Including example: chmod and chown --- tutorial/changeowner.org | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/tutorial/changeowner.org b/tutorial/changeowner.org index 0f03217..0a1416b 100644 --- a/tutorial/changeowner.org +++ b/tutorial/changeowner.org @@ -46,3 +46,58 @@ Then it changed! #+RESULTS: : -rw-rw-r-- 1 compartido compartido 21 jul 18 06:06 fancyfile.org + + +** Changing permission for directories + +Let's say I (unintentionally) changed the permissions for a directory that +contains multiple subdirectories. Let's call that directory "buds" + +I can't access the files without being `root`. This is the outuput in the +command line When a list the directory using `ls -la`. + + +#+begin_example bash + drw-r--r-- 81 user user 4096 dec 26 06:21 buds +#+end_example + +When I go to my git repository and check the change I can see this output for +every file within the directory: + +#+begin_example bash + diff --git a/doc/index.rst b/doc/index.rst + old mode 100644 + new mode 100755 +#+end_example + + +This is how the permission could be changed: + +Note that, in this case, it's necessary to use `sudo` before the command to +access the files + +#+begin_src bash + chmod -R o=wxr,g=xr,o=x buds +#+end_src + + +*** The output now is: + +#+begin_example bash + drw-r-x--x 81 user user 4096 dec 26 06:21 buds +#+end_example + +Remember how it looks before + +#+begin_example bash + drw-r--r-- 81 user user 4096 dec 26 06:21 buds_before +#+end_example + +But I still can open the files. That is because need to change the owner from 755 +to 644: + +#+begin_example bash + chown -R 755 /etc/myfiles +#+end_example + +ps: should use`sudo` to run this command