Restoring user ownership

Restoring user ownership

Post by Mike Perro » Thu, 04 Apr 2002 08:11:35



Anyone with suggestions I haven't tried, please reply.

An older BSDI machine is exhibiting problems.  For a variety
of reasons, there was no working sunstitiute, ready to kick in,
but I have one almost ready.  This box is a nameserver and
POP server, also running sendmail.  That's it.    

With Samba, since we have no tape drive to dump to,
I have been copying users and other stuff to another machine,
via drag and drop from a windows machine to a directory that gets
backed up by our Netware based backup software and tapedrive.

Our mail server (with sector errors) will not even let us create
a new account.  I tried to move all of the accounts (/usr/home stuff
and their /usr/var/mail) to another machine.  Even though I did
the things to recreate POP auth (popauth -init, pwd_mkdb, newaliases,
etc.) people cannot sign in.  I found that every file within the
user's
directory appears to have root ownership.  No doubt from using Samba
to
transfer without the version and switches nec to preserve ownership.

I had the same problem with the mail files, but a shell script I wrote
chowned
them back to the ls name:

        for file in 'ls [a-z]*'
                do chown "$file" "$file"
                done

I got the new box set up so that this was the only problem remaining.
When
plugged into the network, even our Gauntlet firewall thinks it is the
original box, and it handles DNS and sendmail no problem.  Therefore,
I am reluctant to start changing these settings (IP, hostname, DNS
server properties, etc.) just so that I can put it on the network with
a separate identity, and copy the usrs again using rdist or something.
 Is there an easier way - another kind of shell script, perhaps?

I tried the same  script as shown above, but this does not appear to
work so well for those "files" within each user's directory:
        .cshrc
        .profile
        .rhosts
        .xinitrc    ....etc...:

Perhaps because they are a different type of file, so instead of "for
file" it should be something else?  Back a directory (/usr/home) with
"for dirname" didn;t work for these, either.  Or, I should invoke a
routine like adduser to modify them, and it will restore ownership
correctly?  I might need to do chgrp to some also?  Wouldn't their
group membership alter in some cases with ownership change?  (There
are only a few that are not "staff")

Also, is there much danger with me just badsecting the existing
machine?  I
really wanted to have the substitute on line before messing with
badsect or
diskdefect, but we have run out of time.  Are there any special
precautions
I should observe?

Just can't finish this disaster recovery, so I can migrate to FreeBSD
with new hardware.

Kind Regards, Mike

 
 
 

Restoring user ownership

Post by annel.. » Thu, 04 Apr 2002 15:22:05



> Anyone with suggestions I haven't tried, please reply.
> An older BSDI machine is exhibiting problems.  For a variety
> of reasons, there was no working sunstitiute, ready to kick in,
> but I have one almost ready.  This box is a nameserver and
> POP server, also running sendmail.  That's it.    
> With Samba, since we have no tape drive to dump to,
> I have been copying users and other stuff to another machine,
> via drag and drop from a windows machine to a directory that gets
> backed up by our Netware based backup software and tapedrive.
> Our mail server (with sector errors) will not even let us create
> a new account.  I tried to move all of the accounts (/usr/home stuff
> and their /usr/var/mail) to another machine.  Even though I did
> the things to recreate POP auth (popauth -init, pwd_mkdb, newaliases,
> etc.) people cannot sign in.  I found that every file within the
> user's
> directory appears to have root ownership.  No doubt from using Samba
> to
> transfer without the version and switches nec to preserve ownership.
> I had the same problem with the mail files, but a shell script I wrote
> chowned
> them back to the ls name:
>    for file in 'ls [a-z]*'
>            do chown "$file" "$file"
>            done
> I got the new box set up so that this was the only problem remaining.
> When
> plugged into the network, even our Gauntlet firewall thinks it is the
> original box, and it handles DNS and sendmail no problem.  Therefore,
> I am reluctant to start changing these settings (IP, hostname, DNS
> server properties, etc.) just so that I can put it on the network with
> a separate identity, and copy the usrs again using rdist or something.
>  Is there an easier way - another kind of shell script, perhaps?
> I tried the same  script as shown above, but this does not appear to
> work so well for those "files" within each user's directory:
>    .cshrc
>    .profile
>    .rhosts
>    .xinitrc    ....etc...:

> Perhaps because they are a different type of file, so instead of "for
> file" it should be something else?  Back a directory (/usr/home) with
> "for dirname" didn;t work for these, either.  Or, I should invoke a
> routine like adduser to modify them, and it will restore ownership
> correctly?  I might need to do chgrp to some also?  Wouldn't their

No, they're not a different type of file.  They simply begin with a
"dot", so ls doesn't see them unless it's run by root or has the A
switch appended (for "all").  So (possibly), for file in 'ls .[a-z]*'
is what you need, or ls -A

Why not use rsync to copy the files to the new machine?  With
appropriate switches it will work quite well to keep ownership etc.
You could use it on the entire home directory.  But rsync needs to
be running on both machines.  You can certainly install it on the
FreeBSD machine; I'm not sure about the BSDI one.

But maybe I'm missing something?

        Annelise

--
Annelise Anderson
Author of:               FreeBSD: An Open-Source Operating System for Your PC
Available from:  BSDmall.com and amazon.com
Book Website:    http://www.bittreepress.com/FreeBSD/introbook/      

 
 
 

Restoring user ownership

Post by Jed Clea » Fri, 12 Apr 2002 12:46:23




> > Anyone with suggestions I haven't tried, please reply.

> > An older BSDI machine is exhibiting problems.  For a variety
> > of reasons, there was no working sunstitiute, ready to kick in,
> > but I have one almost ready.  This box is a nameserver and
> > POP server, also running sendmail.  That's it.

> > With Samba, since we have no tape drive to dump to,
> > I have been copying users and other stuff to another machine,
> > via drag and drop from a windows machine to a directory that gets
> > backed up by our Netware based backup software and tapedrive.

> > Our mail server (with sector errors) will not even let us create
> > a new account.  I tried to move all of the accounts (/usr/home stuff
> > and their /usr/var/mail) to another machine.  Even though I did
> > the things to recreate POP auth (popauth -init, pwd_mkdb, newaliases,
> > etc.) people cannot sign in.  I found that every file within the
> > user's
> > directory appears to have root ownership.  No doubt from using Samba
> > to
> > transfer without the version and switches nec to preserve ownership.

> > I had the same problem with the mail files, but a shell script I wrote
> > chowned
> > them back to the ls name:

> >       for file in 'ls [a-z]*'
> >               do chown "$file" "$file"
> >               done

> > I got the new box set up so that this was the only problem remaining.
> > When
> > plugged into the network, even our Gauntlet firewall thinks it is the
> > original box, and it handles DNS and sendmail no problem.  Therefore,
> > I am reluctant to start changing these settings (IP, hostname, DNS
> > server properties, etc.) just so that I can put it on the network with
> > a separate identity, and copy the usrs again using rdist or something.
> >  Is there an easier way - another kind of shell script, perhaps?

> > I tried the same  script as shown above, but this does not appear to
> > work so well for those "files" within each user's directory:
> >       .cshrc
> >       .profile
> >       .rhosts
> >       .xinitrc    ....etc...:

> > Perhaps because they are a different type of file, so instead of "for
> > file" it should be something else?  Back a directory (/usr/home) with
> > "for dirname" didn;t work for these, either.  Or, I should invoke a
> > routine like adduser to modify them, and it will restore ownership
> > correctly?  I might need to do chgrp to some also?  Wouldn't their

> No, they're not a different type of file.  They simply begin with a
> "dot", so ls doesn't see them unless it's run by root or has the A
> switch appended (for "all").  So (possibly), for file in 'ls .[a-z]*'
> is what you need, or ls -A

> Why not use rsync to copy the files to the new machine?  With
> appropriate switches it will work quite well to keep ownership etc.
> You could use it on the entire home directory.  But rsync needs to
> be running on both machines.  You can certainly install it on the
> FreeBSD machine; I'm not sure about the BSDI one.

> But maybe I'm missing something?

I'm missing most of this thread, but how about this:

chown -R is your friend in these situations.

for file in `ls /usr/home`; do
        chown -R $file $file
        chgrp -R <users> $file
done

 
 
 

1. user ownership and group ownership

What is the difference between user ownership and group ownership.
For example: I have a user Admin ang group staff ( Admin is not a
menmber of staff ).
chown Adm myfile
chgrp staff myfile
Which privilegies will be available for Adm, and which for user after
those two commands?

Sent via Deja.com
http://www.deja.com/

2. Pause a script

3. Q: Tar doesn't restore ownership from tape?

4. kernel panic:VFS:unable to mount root

5. Problem restoring proper ownership from backup

6. Linux Counter votes on new logo

7. directory ownership after ADSM restore

8. Scsh (a Unix Scheme shell) FAQ

9. File ownerships wrong after Netbackup restore

10. ufsrestore Restores Files with Incorrect Ownership

11. Dump/restore loses ownership info

12. obsolete user ownership problem

13. Apache: user file ownership?