M
M
MultiGramen2021-06-16 12:10:56
linux
MultiGramen, 2021-06-16 12:10:56

How to set permissions to directories only in Linux?

There is a site on which it is necessary to set different rights to directories and files. There are many directories, and even more files in them, so it is inconvenient to assign rights to each of them. Is it possible to recursively set permissions on files only or only on directories in Linux?

Articles on the Internet describe the chmod command in some detail, but for some reason they do not cover such situations.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pfg21, 2021-06-16
@MultiGramen

of course. In Linux, you can do everything and a little more :)

find /path/to/req -type d -exec chmod 0755 {} \;
find /path/to/req -type f -exec chmod 0644 {} \;

type d (directory) - folders, in other words.
type f (file) - files
/path/to/req - path from where browsing starts. (./ for current)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question