Subject: Re: "make install" owerwrites files without asking
To: Pavel Cahyna <pavel.cahyna@st.mff.cuni.cz>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 06/30/2005 10:08:44
On Thu, 30 Jun 2005, Pavel Cahyna wrote:

> On Thu, Jun 30, 2005 at 09:54:42AM -0700, Jeremy C. Reed wrote:
> > As far as I can tell, the chown in your example made no sense. The files
> > were already owned as root:root (when you did mkdir and touch).
>
> You are right, chown was superfluous, so a more interesting example:
>
> $ fakeroot
> bash-2.05a# mkdir fakeroot
> bash-2.05a# ls -ld fakeroot
> drwxr-xr-x    2 root     root            6 Jun 30 18:57 fakeroot
> bash-2.05a# touch fakeroot/login
> bash-2.05a# chown root:utmp fakeroot/login
> bash-2.05a# ls -l fakeroot/login
> -rw-r--r--    1 root     utmp            0 Jun 30 18:57 fakeroot/login
> bash-2.05a#
>
> > Can you do the fakeroot again doing the steps as a non-root user and show
> > the ls -l and tar listing again?
>
> I don't understand how I should do the steps as a non-root user (you mean
> outside the fakeroot environment?)

Do the fakeroot. Then maybe do a su to switch to a non-privileged user. Or
run your fakeroot as non-root in the first place if it allows you.

Or did you run fakeroot as a non-root user in the first place?

If so, I am curious: how does fakeroot keep track of what ownerships are
on files (since they aren't recorded in the filesystem metadata itself
since chown can't work as non-root in the first place).

So for an example, please do:

ls -l somefile
id
fakeroot
id
chown otheruser somefile
ls -l somefile
exit # exit the fakeroot
ls -l somefile

 Jeremy C. Reed

 	  	 	 technical support & remote administration
	  	 	 http://www.pugetsoundtechnology.com/