Re: FYI: safe use of chown ( was Re: kstartupconfig ?)

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

 



On Monday 10 November 2008 05:21:30 Stephen Dowdy wrote:
> Anne Wilson wrote, On 11/09/08 13:51:
> > Funnily enough, I met exactly this error message yesterday.  All I needed
> > to do was to boot into single user mode, then chown -R username:groupname
> > /home/username for the remaining users.
>
> Anne and all,
>
> A tangential word of caution...
> (this is mainly for those who admin multi-user systems where
> you have to consider your user-base as potentially hostile or
> compromised, not necessarily personal/home systems)
>
> # whoami
> joe
>
> # cd ; pwd
> /home/joe
>
> # ln -s /etc/passwd passwd
>
> Guess what happens when you come along as root and do:
>
> chown -R joe:joegroup /home/joe   ???
>
> /etc/passwd gets owned by 'joe'.  (according to POSIX rules on
> symlink dereferencing.  (see chown() and lchown())
>
>
> I have learned to get in the habit of ALWAYS typing '-h' with '-R':
>
>    chown -hR user:group {dir}
>
> where '-h' specifies to NOT traverse/dereference symlinks.
>
> Because all unix-like distributions behave differently, you may need to
> figure out if your linux/unix operates in this fashion and you otherwise
> may need to use some combination of 'find -exec' and variant options to not
> traverse symlinks to do 'chown' operations safely.
>
I've not seen that particular bit of advice before, and it's very valuable.  
Thanks.

Anne

Attachment: signature.asc
Description: This is a digitally signed message part.

___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.

[Index of Archives]     [Trinity (TDE) Desktop Users]     [Fedora KDE]     [Fedora Desktop]     [Linux Kernel]     [Gimp]     [GIMP for Windows]     [Gnome]     [Yosemite Hiking]
  Powered by Linux