Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Question about chown command
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Fulgurance
Veteran
Veteran


Joined: 15 Feb 2017
Posts: 1274

PostPosted: Thu May 22, 2025 4:19 pm    Post subject: Question about chown command Reply with quote

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
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23689

PostPosted: Thu May 22, 2025 4:50 pm    Post subject: Reply with quote

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
View user's profile Send private message
Fulgurance
Veteran
Veteran


Joined: 15 Feb 2017
Posts: 1274

PostPosted: Thu May 22, 2025 5:33 pm    Post subject: Reply with quote

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
View user's profile Send private message
orfgor
n00b
n00b


Joined: 16 Apr 2025
Posts: 4

PostPosted: Sun May 25, 2025 5:27 am    Post subject: Reply with quote

acquire new tip on using 'find' today, thank
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum