Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> Chmod..., totally lost...
Jim
post May 12 2004, 11:07 PM
Post #1


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,280
Joined: 19-November 03
From: University of Minnesota- TC
Member No.: 1,828



Ok, thats it, I admit defeat. I need somebody to point me twords a good tutorial on permission and chmod because I don't get it. I keep locking myself out of my own folders and files, I can't keep user data private from one user to the next, my whole system is one securities nightmare. I need somewhere where I can get more than just a list of numbers, but actually somewhere that will explain what each one really means and how to use it effectively. If I am going to have a server on-line I need to get this under-control. Thanks guys.


--------------------
--Jim Lester
jim@linuxhelp.net

Distro: Gentoo
System: AMD Athlon 3000+ XP 2.166 GHz
NVIDIA nForce2 IGP Chipset
1GB 333 MHz DDR SDRAM
NVIDIA nForce2 Dual Head 64 MB Graphics

Server Distro: CentOS
Go to the top of the page
 
+Quote Post
Termina
post May 13 2004, 12:42 AM
Post #2


RMS is my Hero
******

Group: Support Specialist
Posts: 862
Joined: 18-February 04
From: Wisconsin
Member No.: 2,404



I don't know any site, but I can give you a (probally useless) list of examples. biggrin.gif


chmod -R 750 /home
This would allow the owner to do anything in /home or any other file/dir in it. Members of that group could read and execute (execute: execute executable files, or enter a directory). Other members can't see, enter, etc. /home and the things in it

chown root /public_upload && chgrp hippies /public_upload && chmod 773 /public_upload
This would have your owner be root, with anyone in the "hippies" group having full access. Other users (your anonymous user, for example) can upload stuff to this folder, but will be unable to see anything in it (though can enter it and write to it). This is quite nifty for FTP. They can still view the contents of a file if they know the name of the file though.

chgrp -R nobody public_html
This would make nobody the group that owns this directory, and all files/dirs under it.

chown -R pimp htdocs
Same as above, only it's the username instead of the group. biggrin.gif


Here's the laydown:

Read Write Execute (rwx)
4 2 1

So 5 would be: Read + Execute
6 would be Read + Write
4 would be Read only

Now, there are 3 numbers for each. (Example: 750)

The three stand for: User Group Others

User: (chown!) Is the owner of the folder/file
Group: (chgrp!) Is the group that owns the folder/file
Other: Everyone who isn't that owner/group. smile.gif


--------------------
*Points finger at the author above him* They're a witch! Burn them!
---
Vist my website!
Join me in IRC! Server: st0rage.org Channel: #UnhandledExceptions
Go to the top of the page
 
+Quote Post
Jim
post May 14 2004, 04:15 PM
Post #3


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,280
Joined: 19-November 03
From: University of Minnesota- TC
Member No.: 1,828



Ok, so if I wanted to give everyone access to read a foler, but only a specific user, say enki, to write to that folder, how would I do that?

What I want to create is one user (other than root) who can edit my /var/www/html folder but still allow everyone to download from it.


--------------------
--Jim Lester
jim@linuxhelp.net

Distro: Gentoo
System: AMD Athlon 3000+ XP 2.166 GHz
NVIDIA nForce2 IGP Chipset
1GB 333 MHz DDR SDRAM
NVIDIA nForce2 Dual Head 64 MB Graphics

Server Distro: CentOS
Go to the top of the page
 
+Quote Post
hughesjr
post May 14 2004, 07:05 PM
Post #4


Its GNU/Linuxhelp.net
*******

Group: Admin
Posts: 3,433
Joined: 25-July 03
From: Corpus Chrsiti, TX, USA
Member No.: 1,151



You would make him the owner of the folder and give it 644 permissions ....


rw- r-- r--
42- 4-- 4--
= 644

So:

owner has permissions of r+w (or 4+2) = 6
group has permissions of r (or 4) = 4
everyone not in group has permissions of r (or 4) = 4

-----------------
More examples:

rwx rwx rwx
421 421 421
= 777
everyone has full permissions

r-x r-x r--
4-1 4-1 4--
= 554
owner read/execute, group read/execute,everyone else read

rw- rw- ---
42- 42- ---
= 660
owner read/write, group read/write, everyone else no access.


--------------------
Johnny Hughes
hughesjr@linuxhelp.net
Enterprise Alternatives: CentOS, WhiteBoxEL
Favorite Workstation Distros (in order): CentOS, Gentoo, Debian Sarge, Ubuntu, Mandrake, FedoraCore, Slackware, SUSE
Favorite Server Distros (in order): CentOS, WhiteBoxEL, Debian Sarge, Slackware, Mandrake, FedoraCore, Gentoo, SUSE
Go to the top of the page
 
+Quote Post
Jim
post May 14 2004, 08:19 PM
Post #5


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,280
Joined: 19-November 03
From: University of Minnesota- TC
Member No.: 1,828



how do I make him the owner?


--------------------
--Jim Lester
jim@linuxhelp.net

Distro: Gentoo
System: AMD Athlon 3000+ XP 2.166 GHz
NVIDIA nForce2 IGP Chipset
1GB 333 MHz DDR SDRAM
NVIDIA nForce2 Dual Head 64 MB Graphics

Server Distro: CentOS
Go to the top of the page
 
+Quote Post
Jim
post May 14 2004, 09:54 PM
Post #6


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,280
Joined: 19-November 03
From: University of Minnesota- TC
Member No.: 1,828



Also, this might have nothing to do with chmod, but how to I create a directory on my apache searver than people can browse? I want people to just be able to change to the "stuff" folder and see all the files that are in it, and than download from it.


--------------------
--Jim Lester
jim@linuxhelp.net

Distro: Gentoo
System: AMD Athlon 3000+ XP 2.166 GHz
NVIDIA nForce2 IGP Chipset
1GB 333 MHz DDR SDRAM
NVIDIA nForce2 Dual Head 64 MB Graphics

Server Distro: CentOS
Go to the top of the page
 
+Quote Post
Termina
post May 15 2004, 12:30 AM
Post #7


RMS is my Hero
******

Group: Support Specialist
Posts: 862
Joined: 18-February 04
From: Wisconsin
Member No.: 2,404



chown username folder/file

(Read my first post! arg! wink.gif)

chown termina /candy
chown -R termina /candy (all files/folders in candy are now owned by termina)


--------------------
*Points finger at the author above him* They're a witch! Burn them!
---
Vist my website!
Join me in IRC! Server: st0rage.org Channel: #UnhandledExceptions
Go to the top of the page
 
+Quote Post
hughesjr
post May 15 2004, 07:48 AM
Post #8


Its GNU/Linuxhelp.net
*******

Group: Admin
Posts: 3,433
Joined: 25-July 03
From: Corpus Chrsiti, TX, USA
Member No.: 1,151



But when dealing with apache, the user that runs the apache server is usually nobody or apache ... so if you want to be able to write from lunix and not the web interface, then make the owner and group be the user you want to have write permissions...

for example, if my username is johnny and my primary group is admin and I wanted to make it so only I could update my website, and it resides at /var/www, I would do this:

the chown command is used to change owners ... it can also be used to change owner and group if used in this format:

chown owner:group /directory .... using a -R would make it recursive.

so in my example, I would use this:

chown -R johnny:admin /var/www

Next, to change the permissions, I would do this:

chmod -R 644 /var/www

Now every file and directory under /var/www is owned by johnny, the group is admin, and the permissions are read,write for the user johnny, read for other members of the group admin, and read for everyone else....

If I wanted other people in the admin group to also be able to make changes to the /var/www directory, I would use the command:

chmod -R 664 /var/www


--------------------
Johnny Hughes
hughesjr@linuxhelp.net
Enterprise Alternatives: CentOS, WhiteBoxEL
Favorite Workstation Distros (in order): CentOS, Gentoo, Debian Sarge, Ubuntu, Mandrake, FedoraCore, Slackware, SUSE
Favorite Server Distros (in order): CentOS, WhiteBoxEL, Debian Sarge, Slackware, Mandrake, FedoraCore, Gentoo, SUSE
Go to the top of the page
 
+Quote Post
RogueLdr
post May 15 2004, 03:21 PM
Post #9


Whats this Lie-nix Thing?
*

Group: Members
Posts: 3
Joined: 15-May 04
Member No.: 2,959



I have found this chart to be helpful when trying to figure out chmod. It's based off of the binary numbering system which shows all the possible combinations. Anywhere you see a 1 in the chart it grants the permission listed above that column. Just remember that u,g and o each gets a decimal number that comes from last column of this chart where and it tends to make it easier on me to do the conversion. chmod ugo <file/directory name> where u equals the user(owner), g equals the group and o equals everyone else. After awhile I found I didn't need the chart because you get to know the common numbering for the permissions that you want.

4 2 1
r w x
0 0 0 = 0
0 0 1 = 1
0 1 0 = 2
0 1 1 = 3
1 0 0 = 4
1 0 1 = 5
1 1 0 = 6
1 1 1 = 7
Go to the top of the page
 
+Quote Post
mchclay
post Jun 8 2004, 10:03 AM
Post #10


Whats this Lie-nix Thing?
*

Group: Members
Posts: 3
Joined: 8-June 04
Member No.: 3,118



You can also use letters instead of integers when assigning permissions (some find it easier to remember). See the chmod man page for details.

Good Luck!
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 12th December 2017 - 01:40 AM