LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 05-31-2007, 12:01 AM   #1
mitchell7man
Member
 
Registered: Jan 2007
Location: Provo, UT
Distribution: OSX - Fedora
Posts: 458

Rep: Reputation: 31
Question How to change permissions...


Hello everyone, i have changed permissions on files / folders even hardware in the past, but what i am looking for is some general info, maybe even a "guide" so that i don't have to ask questions every time i have a permissions issue. The thing is I have ubuntu, and i dont want to activate root, so in order to change permissions I must use the command line... so what command do i use to change the permissions on a folder so that it is usable for all users, and what is the "layout" or general format of the command.
Is it something like chmod 777 -directory of folder or device- ?

what are the different numbers 777 = all users right?

I think i have the idea, but i am looking for more info and confirmation. Thanks in advance...
 
Old 05-31-2007, 01:08 AM   #2
ADxD_7
Member
 
Registered: May 2007
Location: CO
Distribution: Solaris , Redhat , Debian
Posts: 152

Rep: Reputation: 23
I use " chmod " this way :

# chmod [options] [permission_code] <file/dir>

Options(that I use alot)

-R = Recursive
-f = force

I use these permission codes :

Thinking of it this way for me makes it easy :

You always have 0000 :

The first 0 is for special perms like setuid , stickybit and setgid
(you can always read up on those)

So here is the whole thing :
Code:
Special User(owner)  Group   World
     0       0             0       0
and then values are like this :

Read = 4

Write = 2

Execute = 1

So then you can add them up and put them in place in the command -

# Example

chmod 0755 (very typical one) file.txt

this would give the user "wrx" the group "rx" and the world "rx" on file.txt

I like it that way because you can do anything with it like all read for anybody but me # chmod 0744 file.txt


Well I hope thats what you needed

Last edited by ADxD_7; 05-31-2007 at 01:13 AM.
 
Old 05-31-2007, 01:14 AM   #3
tristanm
Member
 
Registered: Jun 2005
Location: Pretoria, South Africa
Distribution: Ubuntu, Fedora Core, RHEL
Posts: 37

Rep: Reputation: 15
Hi.

I don't know of any guide other than using the man or info pages.
Type:
man chmod
or
info chmod

From my personal experience:

chmod u+w filename - will give a user write permission on the file.
chmod u+r filename - will give a user read permission on the file.
chmod u+x filename - will give a user execute permission on the file.


chmod g+w filename - will give the group write permission on the file.
chmod o+w filename - will give others write permission on the file.
chmod a+w filename - will give all (everybody) write permission on the file.

chmod a+w directory - will change directory permissions.

chmod -R a+w directory - will change directory permissions recursively.

If you use the format:

chmod 777 filename
The first number is the permission level given to the user, the second number is the permission level given to the group and the third number is the permission level given to others.

The levels are as follows:
0 - no permission
1 - execute only
2 - write only
3 - write and execute
4 - read only
5 - read and execute
6 - read and write
7 - read, write and execute

Note: be careful when using the recursive option as you don't want to suddenly change a system directories permissions recursively...

Last edited by tristanm; 05-31-2007 at 01:17 AM.
 
Old 05-31-2007, 08:54 AM   #4
mitchell7man
Member
 
Registered: Jan 2007
Location: Provo, UT
Distribution: OSX - Fedora
Posts: 458

Original Poster
Rep: Reputation: 31
what exactly is recursively? repeatingly, but how, what or what exactly will happen if it is changed recursively?> And thanks for the explanations, both were very helpfull.
 
Old 05-31-2007, 09:45 AM   #5
tristanm
Member
 
Registered: Jun 2005
Location: Pretoria, South Africa
Distribution: Ubuntu, Fedora Core, RHEL
Posts: 37

Rep: Reputation: 15
Recursively means that it performs the operation on the directory and its contents as well as every sub-directory and their contents.
 
Old 05-31-2007, 10:34 AM   #6
mitchell7man
Member
 
Registered: Jan 2007
Location: Provo, UT
Distribution: OSX - Fedora
Posts: 458

Original Poster
Rep: Reputation: 31
Ok, thanks a lot,
 
Old 05-31-2007, 01:17 PM   #7
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 59
Here is a decent guide:
http://www.comptechdoc.org/os/linux/..._ugfilesp.html
 
  


Reply

Tags
chmod, codes, permissions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change permissions rust8y Solaris / OpenSolaris 4 11-20-2006 05:10 AM
How to change permissions? SonoranFun Linux - Newbie 4 11-02-2004 10:10 AM
Can't change permissions LitlJay Linux - Software 9 05-21-2004 01:41 PM
can't change permissions on the second hd (hdd1) djchris Linux - Newbie 5 05-10-2004 02:28 PM
How Can I Change Permissions monkeymartin Linux - General 1 03-25-2003 12:47 PM


All times are GMT -5. The time now is 10:12 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration