chown question

2009-07-02 Thread Douglas A. Tutty
Hello all,

I have a really basic question; I really messed up my box.

I was doing a reinstall on an old box after a drive failure.  I restored
/home but one of the UIDs were created differently so I needed to chown
their directory, including all the hidden files in their ~/.

Without thinking, as root I did a:

r...@plot:/home/dtbrowser# chown -R dtbrowser.dtbrowser .*

Unfortunatly, no everyting on the box is owned by dtbrowser.  It walked
up the file tree (presumably via . and ..) and changed everything.

I know that I could have used find to look for all files owned by the
old UID, plunked it through xargs and chowned them that way, but is
there a way, as root, to chown directly the hidden files without
chowning the whole box?

Just for my future reference?

Thanks,

Doug.


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: chown question

2009-07-02 Thread Chris Jackson

Douglas A. Tutty wrote:


I know that I could have used find to look for all files owned by the
old UID, plunked it through xargs and chowned them that way, but is
there a way, as root, to chown directly the hidden files without
chowning the whole box?



The simplest way would be to recursively chown the home directory:

chown chrisj.chrisj ~chrisj

That won't follow the .. link.

--
Chris Jackson


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org




Re: chown question

2009-07-02 Thread Mark Allums

Douglas A. Tutty wrote:

Hello all,

I have a really basic question; I really messed up my box.

I was doing a reinstall on an old box after a drive failure.  I restored
/home but one of the UIDs were created differently so I needed to chown
their directory, including all the hidden files in their ~/.

Without thinking, as root I did a:

r...@plot:/home/dtbrowser# chown -R dtbrowser.dtbrowser .*

Unfortunatly, no everyting on the box is owned by dtbrowser.  It walked
up the file tree (presumably via . and ..) and changed everything.

I know that I could have used find to look for all files owned by the
old UID, plunked it through xargs and chowned them that way, but is
there a way, as root, to chown directly the hidden files without
chowning the whole box?

Just for my future reference?

Thanks,

Doug.




That's the most awesome global file oopsie I've heard of in a long time!

I think I would probably have used ~ instead of * in some way.  Or, 
named more of the full path, and depended a little less on the wildcard.


Anything combining a * with a . is usually asking for trouble, I've found.

Gives me the willies just thinking about it.

Mark Allums



--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org




Re: chown question

2009-07-02 Thread Chris Burkhardt
Douglas A. Tutty wrote:
[...]
 I know that I could have used find to look for all files owned by the
 old UID, plunked it through xargs and chowned them that way, but is
 there a way, as root, to chown directly the hidden files without
 chowning the whole box?
 
 Just for my future reference?

I found this suggestion from some message board*

$ chown user:group .[!.]*

That uses the shell pattern matching to exclude '..' by skipping any files whose
second character is a dot. Unfortunately it will also skip any hidden files with
names like '..filename'

*http://forums11.itrc.hp.com/service/forums/questionanswer.do?admit=109447626+1246551046034+28353475threadId=966579

- Chris B


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: chown question

2009-07-02 Thread Johannes Wiedersich
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Douglas A. Tutty wrote:
 I know that I could have used find to look for all files owned by the
 old UID, plunked it through xargs and chowned them that way, but is
 there a way, as root, to chown directly the hidden files without
 chowning the whole box?

Instead of
 r...@plot:/home/dtbrowser# chown -R dtbrowser.dtbrowser .*

do
r...@plot:/home/dtbrowser# chown -R dtbrowser.dtbrowser /home/dtbrowser/.*

[in one line]

Cheers,
Johannes

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpM3xQACgkQC1NzPRl9qEW8wQCeMzJAwaoOYNmhw9Ue+2/MktrZ
8TwAn24qjU+bl7vypxSDDQpLk+4LVXDx
=vIsj
-END PGP SIGNATURE-


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: chown question

2009-07-02 Thread Chris Burkhardt
Chris Jackson wrote:
 Douglas A. Tutty wrote:
 
 I know that I could have used find to look for all files owned by the
 old UID, plunked it through xargs and chowned them that way, but is
 there a way, as root, to chown directly the hidden files without
 chowning the whole box?
 
 
 The simplest way would be to recursively chown the home directory:
 
 chown chrisj.chrisj ~chrisj
 
 That won't follow the .. link.

Shouldn't that include the recursive flag?

chown -R chrisj.chrisj ~chrisj

Otherwise it just changes the owner of the directory and not all the
files in it.

And here are a couple of other flags from the chown(1) manpage which render
chown a less dangerous command:

--from=CURRENT_OWNER:CURRENT_GROUP
change the owner and/or group of each file only if its current owner
and/or group match those specified here.  Either may be omitted, in
which case a match is not required for the omitted attribute.

--preserve-root
fail to operate recursively on /

- Chris B


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: chown question

2009-07-02 Thread Chris Burkhardt
Johannes Wiedersich wrote:
 Douglas A. Tutty wrote:
 I know that I could have used find to look for all files owned by the
 old UID, plunked it through xargs and chowned them that way, but is
 there a way, as root, to chown directly the hidden files without
 chowning the whole box?
 
 Instead of
 r...@plot:/home/dtbrowser# chown -R dtbrowser.dtbrowser .*
 
 do
 r...@plot:/home/dtbrowser# chown -R dtbrowser.dtbrowser /home/dtbrowser/.*

Hi Johannes,

Wouldn't the shell still expand the argument list to include
'/home/dtbrowser/..' and result in the same problem?

- Chris B


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Re: chown question

2009-07-02 Thread Chris Jackson
Chris Burkhardt wrote:

 chown chrisj.chrisj ~chrisj
 
 That won't follow the .. link.
 
 Shouldn't that include the recursive flag?
 
 chown -R chrisj.chrisj ~chrisj


Apologies, yes it should.

--
Chris Jackson
Shadowcat Systems Ltd.


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org