B
B
BlagoYar Silence2022-01-07 04:31:31
linux
BlagoYar Silence, 2022-01-07 04:31:31

How to save permissions to a file?

There is a directory with subdirectories and files.
You need to save the rights to the file, so that later, in which case, restore it to its original state.
Can it be done? If so, how?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vasily Alibabaevich, 2022-01-07
@BlagoYar

Archive tar.gz

S
Saboteur, 2022-01-07
@saboteur_kiev

Just make a list. Then you can restore it with a script.

find . -exec stat --format '%a %n' {} \;

find . -exec stat --format '%a %n' {} \; > list_of_files.txt

M
mureevms, 2022-01-07
@mureevms

ls -lhR /path/to/dir > permissions.txt

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question