LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Distributions (https://www.linuxquestions.org/questions/linux-distributions-5/)
-   -   Question about permissions (https://www.linuxquestions.org/questions/linux-distributions-5/question-about-permissions-324845/)

UnforgotteN 05-18-2005 07:33 PM

Question about permissions
 
I own a linux server centos 3.4.

I have some files that i allow friends access to, but some files i dont want them to be able to modify.

My question is, How do i set permissions on some files so that some files can be owned and only rewrite by root, and some can be owned and rewrite by root and also users (my friends).

John,
Thanks!

mjrich 05-18-2005 07:43 PM

man chmod, man chown ;)

Essentially, you'll have to run chown root <somefile> followed by the appropriate chmod command.

Cheers,

mj

UnforgotteN 05-18-2005 07:54 PM

Im sorry, im totally new using linux.

what would be the appropiate command to only allow me (root) have total control of that file, i mean still let my freinds see it but other than that everything.

what are the commands for chmod? also is that done in one single code like

chown root <somefile> chmod <command>

or in 2

chown root <somefile>
chmod<command>

Thanks Alot for answearing bud!

mjrich 05-18-2005 08:14 PM

What do you mean by 'total control' ? Root has this by definition.

Permissions are usually either read, write, or execute. Thus, assuming you want root to be the only one to be able to read & write to a file that he/she doesn't yet own, then
Code:

chown root <somefile>
chmod -v 0600 <somefile>

Chmod and chown are two separate commands, however both can accept wildcards, redirects and so on, so you could readily do for f in *.tex; do chmod 0600 $f; done, or chmod -v 0600 *.eps.

mj

UnforgotteN 05-18-2005 08:21 PM

so -v 0600 is the command so that the file can be write and read only by the person who we set the chown command to?

what if i want the user to read the file but not to write it, then what chmod command do we use?

"however both can accept wildcards, redirects and so on, so you could readily do for f in *.tex; do chmod 0600 $f; done, or chmod -v 0600 *.eps."

I don't understand that... what do you mean bud, I'm starting to learn so there is a lot of stuff i still cant understand, please explain that with more details bud. :)

mjrich 05-18-2005 08:32 PM

No, 0600 is the octal representation of the permissions to be set -- in this case, read/write for the owner (in this case root), permissions denied for all other users. This could also be done in character mode, for example chmod -v u=rw <somefile> && chmod -v go-rwx. If you run these commands, and have a read of the manual page (type man chmod into a terminal) you will see what is happening. "u" stands for the current user/owner of the file, "g" the group members of the file, "o" others", and "a" all users.

Alternatively, you can also change file permissions using most graphical file browsers -- for example on the permissions tab in KDE's Konqueror.

The most useful thing to do, honestly, is to a) READ READ READ, and b) play around with your system as much as possible.

Cheers,

mj

UnforgotteN 05-18-2005 08:51 PM

Thanks alot bud!


All times are GMT -5. The time now is 05:39 PM.