LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   chmod directories??? (https://www.linuxquestions.org/questions/debian-26/chmod-directories-434383/)

rev_swid 04-12-2006 03:33 AM

chmod directories???
 
Complete Newbular here!

Anyways, just started using ol' Debian Sarge, love it!

My question is this:

I had set up all files in my root directory instead of as a user until someone kindly informed me this was very bad form. So I moved all my files over to user. Now I am having permissions issues everytime I try to save a file. Do I have to go into the files and chmod every single one of them, or is there a way to set blanket permissions for the lot?


Thanks!

reddazz 04-12-2006 04:05 AM

Change ownership of all the files from root to yourself using chown e.g. to change ownership of all files is a directory called dir in your home directory do
Code:

#chown -R user:group /home/user/files/

rev_swid 04-12-2006 04:09 AM

user:group

how do i define group?

reddazz 04-12-2006 04:11 AM

Quote:

Originally Posted by rev_swid
user:group

how do i define group?

group is the primary group of the user. If you run "id user", the users name, primary group and other groups are printed on the screen.

rev_swid 04-12-2006 04:37 AM

ok, here is what i entered and here is what it yielded:

john:/home/john/john# id -u
0
john:/home/john/john# id -u john
1000
john:/home/john/john# id -G
0

not sure how to interperet 0 and 1000

reddazz 04-12-2006 04:41 AM

What are the results or running "id" without any other options. -u would be your username and -g would be your primary group. -G is for other groups.

rev_swid 04-12-2006 04:50 AM

john:/home/john/john# id
uid=0(root) gid=0(root) groups=0(root)

rev_swid 04-12-2006 04:57 AM

ran # chown -R john:0 /home/john/john

seemed to do the trick!

thanks

reddazz 04-12-2006 05:37 AM

Why are you using the root group as your primary group? This is something that should be avoided if possible because of security reasons and because you can do damage to your own system if you have access to stuff that should belong to root only. I think in Debian you should use a group thats similar to your own name or use the users group.

rev_swid 04-12-2006 06:36 AM

How would I go about changing that?

farslayer 04-12-2006 08:14 AM

Typically the system creates a group with the same name as the user...

I would think this would be more correct for a users home directory..
# chown -R john:john /home/john/john

When logged in as your user you can simply type the command groups username to see what groups the user belongs to..
Quote:

john@rac:/home/john$ groups john
john: john dialout cdrom floppy audio video plugdev
First check what groups your user is a member of then we'll see what all should be changed..
john should NOT be a member of the group root..

reddazz 04-12-2006 08:36 AM

Check if there is a group that matches the users username in /etc/group. If there is, run "usermod -g group user". If the groupd does not exist, create it before running usermod.

rev_swid 04-12-2006 09:14 AM

Created groups "users" and added john


here is the output:

john:/home/john# groups john
john : users dialout cdrom floppy audio video plugdev

what next?

reddazz 04-12-2006 09:29 AM

As long as you have changed the primary group for john to users (usermod -g users john), then thats it.

rev_swid 04-12-2006 10:26 AM

Thank y'all very much! It is shocking the difference in level of support for Linux and Microsoft.


All times are GMT -5. The time now is 09:29 PM.