# [SOLVED]Screwed-up my system because of permissions

## zacinfinite

I recently learnt about linux permissions and was over excited. I was playing around and This is what I did:-

root~# usermod -ag sys zac                                  # zac is the normal user, adding to group "sys"

root~# chgrp -R sys /                                             #adding all the files and directories to group "sys", including root subdirectioy.

root~# chmod -R 777 /                                           #changing permissions to -rwxrwxrwx

Now when I restart the system, i cannot login to any user (even after providing the correct username and password, can't even login as root)

I believe I need to learn about Default permissions for every sub-folders under '/'

So please if you know about default permissions and way to log on as normal user, HELP!Last edited by zacinfinite on Sat Oct 01, 2011 3:10 pm; edited 1 time in total

----------

## NeddySeagoon

zacinfinite,

Go to Jail, go directly to jail, do not pass go, do not collect 200 <local_currency>

```
root~# chmod -R 777 /
```

is one of the few ways to trash a Gentoo install beyond recovery.

Boot with a CD, save any valuable user data you may have in /home then reinstall.

----------

## zacinfinite

OMG! HA HA HA HA. So I finally ruined my entire system? It took me 7 days to install Gentoo. LOL

Hey, but its not fair. U expert people should write an article about this bug in every Linux-permissions tutoral. Im just learning Linux, how am i supposed to know what not to do? I was just experimenting.

Ok in the end only knowledge counts, so can you tell me what to do and what not to do with permissions or can you provide any links?

----------

## Anon-E-moose

When a package gets emerged, the permissions will be set properly.

stay away from using "-R" with chmod as well as "-r" with rm unless you really understand what they do

----------

## zacinfinite

But as a system admin you need to have knowledge of permissions about filesystem hierarchy. If someone wants to make his system secured they need to set permissions but if some permissions damage the system, EVERYBODY SHOULD KNOW ABOUT IT!

I wonder why I never read about this in any Linux-permissions tutorial! Have you?

----------

## PaulBredbury

 *zacinfinite wrote:*   

> if some permissions damage the system

 

How can I put this... As the root user, you are God - you are meant to be infinitely knowledgeable, because you have infinite power.

I doubt there's anyone who has *not* trashed their system a few times, while playing like you - I certainly have. All part of the learning experience. Reading about someone else doing it, in a book, just doesn't stick in one's memory the same  :Laughing: 

I recommend in /root/.bashrc

```
# Sane root deletion - http://forums.gentoo.org/viewtopic-t-526247.html

alias rm='rm --preserve-root'

# As shown in:  man chmod

alias chmod='chmod --preserve-root'

alias chown='chown --preserve-root'
```

----------

## NeddySeagoon

zacinfinite,

Make yourself a sandpit in a virtual machine.

Make a copy of the VM.  When you trash your sandpit, you clone the copy. Its a lot faster than a reinstall.

VirtualBox is easy to setup.

chown -R ...  is just as dangerous.

----------

## zacinfinite

OKEY DOKEY I guess its time to learn some Precious Lessons. Thanks guys

----------

## cwr

Boot off a CD, mount the root filesystem, and run "find . -type d -exec chmod 755 {} \;"

and the same for type f and 644 should get a workable system back.  There will still

be problems with suid files, but I'd expect at least logon to work.

Probably quicker just  to re-install, though.

Will

----------

