chmod and symbolic links
chmod -R in Solaris will change permissions on subdirs and when encountering a symbolic link, will change the permission on the pointed to file whether it be a file or just a directory and stop. c
hmod -R in SuSE seems to follow symbolic links through the whole directory structure. Is this a bug in chmod? |
No, -R option "change files and directories recursively" (from the Linux manual page). The Solaris manual page "Recursively descend through directory arguments, setting the mode for each file as described above. When symbolic links are encountered, the mode of the target file is changed, but no recursion takes place."
Keep in mind that Solaris is, pretty much, System V and Linux is, pretty much, GNU (which stands for Gnu's not Unix). GNU utilities don't always work the same way Solaris' do. |
Don't care what happens to the symlink permissions. I know that the permissions should change to the pointed to file. But the permissions will continue to change for all files under the link and traverse any other symbolic links encountered.
If there is a Directory space called ABC and in this directory structure there is a symbolic link to /data/mydata for example, and when make chmod permissions for the project space ABC, it will follow the mydata link and change all the permissions on the mydata files Is there any option to avoid this? |
Quote:
|
Well, that's what the -R option seems like it's supposed to do... I'm wondering of I'm reading it correctly that the --preserve-root (fail to operate recursively on `/') option may be what you want (given your example)?
Or, maybe using a combination of find with the -P option (never follow symbolic links), xargs and chmod? Something like Code:
find -P <path> -type f -print | xargs chmod mode |
All times are GMT -5. The time now is 12:59 AM. |