View previous topic :: View next topic |
Author |
Message |
Fulgurance Veteran


Joined: 15 Feb 2017 Posts: 1274
|
Posted: Thu May 22, 2025 4:19 pm Post subject: Question about chown command |
|
|
Hi guys, I have one question.
I was using recently the command chown in a project recently with find to change a whole directory owner recursively from a user to root, excepted some files. Anyway.
But I noticed that symlinks stay owned as the user. Is it possible to change both owner as root for the file AND the symlink ?
This is the command I used:
Code: |
find /mnt/ism \
-path /mnt/ism/sources -prune \
-o -path /mnt/ism/tools -prune \
-o -exec chown root:root {} +
|
Basically the symlink sbin pointing to /mnt/ism/usr/sbin is still owned by the standard user after I ran this command. Why ? _________________ My actual project: https://github.com/Fulgurance/ISM
Ingenius Software Manager is a tool to build and manage a Linux system from scratch.
It will able to manage a linux installation just with a given path to the futur root path |
|
Back to top |
|
 |
Hu Administrator

Joined: 06 Mar 2007 Posts: 23689
|
Posted: Thu May 22, 2025 4:50 pm Post subject: |
|
|
According to the info page: info chown: | ‘--dereference’
Do not act on symbolic links themselves but rather on what they
point to. This is the default when not operating recursively.
| Your invocation is not recursive, so --dereference is default-enabled. If you want to act on the symlink, do not dereference it. |
|
Back to top |
|
 |
Fulgurance Veteran


Joined: 15 Feb 2017 Posts: 1274
|
Posted: Thu May 22, 2025 5:33 pm Post subject: |
|
|
Ah okay I understand better now. Thank you mate _________________ My actual project: https://github.com/Fulgurance/ISM
Ingenius Software Manager is a tool to build and manage a Linux system from scratch.
It will able to manage a linux installation just with a given path to the futur root path |
|
Back to top |
|
 |
orfgor n00b

Joined: 16 Apr 2025 Posts: 4
|
Posted: Sun May 25, 2025 5:27 am Post subject: |
|
|
acquire new tip on using 'find' today, thank |
|
Back to top |
|
 |
|