0

What will these below commands actually do?

chmod 777 /yoda/htdocs/cups/logs/*
chmod -R -f 777 /yoda/htdocs/cups/logs/

When I check the file permissions in ..../logs folder, they are showing as

-rw-r-----

But why is this happening when I actually changed the permissions of all the files in the first command itself

7
  • The second chmod command should set the permissions as rwxrwxrwx. Is that a typo? Where is the rw-r permission taken from?
    – Haxiel
    Commented Dec 5, 2018 at 7:52
  • No. it's not a typo. I'm not sure where the rw-r permission is coming from. Is it the second command that is doing something related to it? Commented Dec 5, 2018 at 8:00
  • The first command is over-ridden (you don't need it). I have no idea why the second did not do what it should have done. (Have you tried without the -f?) Commented Dec 5, 2018 at 8:02
  • @TywinLannister Does your user account have the necessary permissions for this 'logs' directory and the files inside it? You could add the output of ls -l for the directory and the files so that we can check.
    – Haxiel
    Commented Dec 5, 2018 at 8:04
  • The files are being created after the permissions are set. Is there any way that I can mention before the files are being created ? so that any file that gets created in the logs folder witll have permissions as 777 Commented Dec 5, 2018 at 8:44

1 Answer 1

0

chmod 777 /yoda/htdocs/cups/logs/*
will add 777 permission for all files in logs directory.

chmod -R 777 /yoda/htdocs/cups/logs/
will add 777 permission to logs directory and all directories and files inside recursively
for more info check below link
https://en.wikipedia.org/wiki/Chmod

If you want to assign permission for files which will be created in future. For that you need to use umask functionality.
https://www.computerhope.com/unix/uumask.htm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .