Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #235366

Re: Restoring sticky bits after accidentally moving /usr directory

From Andy Smith <andy@strugglers.net>
Newsgroups linux.debian.user
Subject Re: Restoring sticky bits after accidentally moving /usr directory
Date 2021-05-19 13:00 +0200
Message-ID <Cgs5I-7oG-5@gated-at.bofh.it> (permalink)
References <CggnT-vt-1@gated-at.bofh.it> <CghDj-19q-3@gated-at.bofh.it> <Cglnz-3p9-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hello,

On Tue, May 18, 2021 at 11:40:38PM -0400, Greg Wooledge wrote:
> On Tue, May 18, 2021 at 11:46:38PM +0000, Andy Smith wrote:
> > I can't think of an easy way if you don't have backups. If you have
> > another system you could get a list of all its permissions like so:
> > 
> > # find /usr -xdev -printf '%p %m\0' | sort -z > good-perms
> > 
> > Then on your suspect machine:
> > 
> > # find /usr -xdev -printf '%p %m\0' | sort -z > suspect-perms
> > 
> > And then run this perl script:
> > 
> >     https://gist.github.com/grifferz/1c478ea5eb789b2a1d1a3e49d2a9345c
> 
> The serialization format you're using (pathname followed by mode) is
> not ideal for parsing.  I'd suggest putting the mode *first*, because it's
> in a known, fixed format, and then the pathname second.

I was wondering about that at the time but it seemed like the end of
each item could only ever be a space, a sequence of digits and then
\0, so I didn't think it could be a problem. But yeah, not too many
changes needed if you want to switch them around.

I also realised later that there isn't too much point in sorting the
both the file lists. I did that because I was initially going to use
the "comm" command, which needs the files to be sorted, but later
decided against it.

If you are happy with seeing the results in the order that the
"suspect-perms" find command outputs them, then just don;t bother
sorting either of them.

Cheers,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Restoring sticky bits after accidentally moving /usr directory Steve Dondley <s@dondley.com> - 2021-05-19 00:30 +0200
  Re: Restoring sticky bits after accidentally moving /usr directory Andy Smith <andy@strugglers.net> - 2021-05-19 01:50 +0200
    Re: Restoring sticky bits after accidentally moving /usr directory s@dondley.com - 2021-05-19 02:10 +0200
    Re: Restoring sticky bits after accidentally moving /usr directory Greg Wooledge <greg@wooledge.org> - 2021-05-19 05:50 +0200
      Re: Restoring sticky bits after accidentally moving /usr directory Andy Smith <andy@strugglers.net> - 2021-05-19 13:00 +0200
  Re: Restoring sticky bits after accidentally moving /usr directory David <bouncingcats@gmail.com> - 2021-05-19 02:20 +0200
  Re: Restoring sticky bits after accidentally moving /usr directory songbird <songbird@anthive.com> - 2021-05-19 02:30 +0200
    Re: Restoring sticky bits after accidentally moving /usr directory Tixy <tixy@yxit.co.uk> - 2021-05-19 08:50 +0200
      Re: Restoring sticky bits after accidentally moving /usr directory Tixy <tixy@yxit.co.uk> - 2021-05-19 09:00 +0200
  Re: Restoring sticky bits after accidentally moving /usr directory Andrei POPESCU <andreimpopescu@gmail.com> - 2021-05-19 09:30 +0200
  Re: Restoring sticky bits after accidentally moving /usr directory Hans <hans.ullrich@loop.de> - 2021-05-19 12:40 +0200
    Re: Restoring sticky bits after accidentally moving /usr directory Steve Dondley <s@dondley.com> - 2021-05-19 19:20 +0200
      Re: Restoring sticky bits after accidentally moving /usr directory songbird <songbird@anthive.com> - 2021-05-19 20:00 +0200

csiph-web