chmod problem
ZIYAD A. M. AL-BATLY
zamb at saudi.net.sa
Sat May 7 07:18:22 UTC 2005
On Fri, 2005-05-06 at 23:34 -0400, Matthew S-H wrote:
> I just made a slight "oopsie".
> I was changing the permissions of everything in a directory inside my
> home folder recursively, and I meant to type "chmod 777 .a*", but I
> accidentally typed "chmod 777 .*". I stopped it in the middle of what
> it was doing right after noticing an error referring to a file it
> couldn't change the permissions of. It stopped while in the middle of
> changing permissions something in a directory within my home
> directory.
> Now everything in my home folder with a starting letter before "L" (i
> guess it was doing it in alphabetic order) has the permissions 777
> (rwx for all users). Does anyone know of any way I can get back the
> defaults? Or of any way I can have the permissions reverted to the
> way they were less than 10 minutes ago?
> Note that my last backup was a LONG time ago. I'd rather deal with
> unrestricted permissions than with losing all of my recent work.
>
> ~Matt
>
I don't know anything that can revirt to what was 10 minutes ago
(except, of course, backups). But here's a solution:
find $HOME -type f -print0 | xargs -0 chmod 0600 &&
find $HOME -type d -print0 | xargs -0 chmod 0700 &&
echo "You're done! Everything (hopefully) is okay."
The above will do the following:
* Find all the *files* in your home and change their permission so
that you *only* can read/change them.
* Find all the *directories* in your home and change the
permission so that you *only* have the right to
read/write/access them.
Something to be caution about:
Any executable files in your home will lose the execute bit!
(Like shell/Perl/Python scripts, and applications you compiled
yourself.)
Ziyad.
More information about the ubuntu-users
mailing list