JP Vossen on 28 May 2009 14:52:33 -0700

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

Re: [PLUG] Restore proper profile permissions

> Date: Tue, 26 May 2009 20:49:47 -0400
> From: Adam Zion <>
> A while back, I messed w/the permissions of my local linux account (it
> was, as I said, a stupid accident). Since then, KDE has acted oddly,
> and I suspect strongly it's due to the perms being wrong. Is there any
> easy way to restore the permissions, or would I be better off creating
> a new profile, copying over files I need, removing the hosed profile,
> + then renaming the new one?

OK, if I was stuck with this with no backups, I'd create a new user, log 
into it and run apps like I usually do, then duplicate perms as follows. 
  (Gabriel already suggested this approach, but without the following 
details. :)

$ sudo su -
# find /home/NEWuser -printf "chmod %m '%p' && chown %u.%g '%p'\n" > 
# less /tmp/fixperms
# perl -i -pe 's!/home/NEWUSER!/home/OLDuser!g;' /tmp/fixperms
# less /tmp/fixperms
# bash /tmp/fixperms
# rm /tmp/fixperms
# exit

I have tested the above a bit, but NOT tried it on a real user dir, so 
make a copy first.  The less lines are for manual sanity checks that 
things "look right."

Other caveats:
* This only re-sets perms for files and dirs that exist for NEWuser, 
that's why you want to run as many apps and so forth as you can to try 
and create config dirs and files.
* It'll generate errors for things that exist under NEWuser but not 
under the old one.
* You can edit the fixperms file and/or grep stuff out of it as needed 
before actually applying it.

Good luck,
JP Vossen, CISSP            |:::======|
My Account, My Opinions     |=========|
"Microsoft Tax" = the additional hardware & yearly fees for the add-on
software required to protect Windows from its own poorly designed and
implemented self, while the overhead incidentally flattens Moore's Law.
Philadelphia Linux Users Group         --
Announcements -
General Discussion  --