coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

chmod don't affect referenced file of symbolic links


From: mn
Subject: chmod don't affect referenced file of symbolic links
Date: Sat, 16 Sep 2023 14:26:18 +0800

Hello,

I would like to suggest and offer the code to extend chmod in a small way. My 
extension don’t affect referenced file of symbolic links, just avoid them 
silent.

I need this ability, because I have a problem like this: Some times we need to 
change mode of files in a directory recursively with root privilege. For 
example, the directory “/opt/xxxx”, I have installed many files in the 
directory, and files have different owner and mode. Some mode and owner of 
files are wrong, so I need to fix them by a program with root privilege. For 
security reason, we don’t want to affect files not in that directory, like 
“/etc/passwd”. Then, I found ‘-h’ parameter in “chown”, it help me to protect 
“/etc/passwd”, but in “chmod”, there is not similar parameter not to 
dereference symbolic links.

The patch is to provide “-h” in chmod, it works similar to it in “chown”. If 
the object file is a symbolic link, chmod skip it, and move to next file with 
“-h”. parameter.

Because my system is ubuntu 22.04, it can not install vc-dwim. I have to make 
the patch by git directly.



Nan Meng.


Attachment: chmod.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]