0

A newbie here.

Can someone help me understand what are the effects of running the following command from a directory:

sudo chmod -R 777 *

Will it effect the whole file system or the contents of that particular directory?

Thanks

1 Answers1

3

It will affect the directory the command is run from and all subdirectories.

The sudo implies root access.

The -R is recursive, so goes through subdirectories.

The * implies all files/directories.

The 777, of course, makes the files read, write and executable for all users and is generally not a great idea from a security point of view.

user35042
  • 2,681
  • 12
  • 34
  • 60
davidgo
  • 6,222
  • 3
  • 23
  • 41
  • thanks. Can you suggest what permission level should I use instead? – Adil Saleem Dec 29 '19 at 07:56
  • Unfortunately not - it entirely depends on what you are trying to achieve - in terms if what the files will he used for, who should have access to them and if they are programs. Making things more interesting is a similar command "chown" which changes the owner and group of the files. – davidgo Dec 29 '19 at 07:59
  • It’s also rare for the best permissions for an entire hierarchy to be the same. Usually, you want execute access to directories, but not to files (except for actual executables). Also, changing the perms on system files without knowing what you’re doing can easily render the system unusable or even unbootable. Be careful with `sudo`! – Gordon Davisson Dec 29 '19 at 09:02
  • Thanks for your response, guys. I'll explore more and set permission as per my use case. – Adil Saleem Dec 29 '19 at 13:17