Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-22-2006, 08:54 AM   #1
Registered: Dec 2003
Posts: 64

Rep: Reputation: 15
Basic chmod question

I did some reading on this but still not clear.

How do I give the user sam both read and write privileges to folder /var/www/html/sams_website?
Old 03-22-2006, 09:00 AM   #2
Registered: Dec 2005
Location: South Africa
Distribution: CentOS,Ubuntu,Fedora
Posts: 249

Rep: Reputation: 30

Do the following

If user sam is the owner of the directory

# chmod 755 /var/www/html/sams_website

If user sam is just a user

# chmod 775 /var/www/html/sams_website
Old 03-22-2006, 09:25 AM   #3
Registered: Dec 2003
Posts: 64

Original Poster
Rep: Reputation: 15
sam is not the owner

My problem is sam is not the owner of the directory.

1. Do I need to make sam the directory owner for me to give that account read and write access

2. If I do, how do I make sam the owner of the directory?
Old 03-22-2006, 09:33 AM   #4
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 740Reputation: 740Reputation: 740Reputation: 740Reputation: 740Reputation: 740Reputation: 740
Originally Posted by shawnbishop

If user sam is just a user

# chmod 775 /var/www/html/sams_website
This **might** work---some clarification:

The permissions are in the order: owner, group, others Thus, the above command gives full privileges to the owner and the group. This will work only if Sam is a member of the file's assigned group.

To give access to any user: chmod 777

To give access to ONLY Sam, where he is not the owner of the file, then Sam would have to be the only member of the file's group

If you're wondering what all the numbers mean:
for each digit: 4=read, 2=write, 1=execute
7= full privilege
6= read/write only
5= read/execute only
Old 03-22-2006, 11:26 AM   #5
Senior Member
Registered: Apr 2005
Location: London
Distribution: Arch - Latest
Posts: 1,522

Rep: Reputation: 45
if Sam is to have complete control over the directory, make him the owner:

chown sam <directory>
that way you can set permissions 755 - rwx for owner, rx for group (need these to view a dir), rx for everyone else (probably needed as it's for a website).

777 isn't recomended before you do that for ease


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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
chmod question Napalm Llama Linux - General 2 06-17-2005 10:17 AM
chmod question tongar Linux - Newbie 2 01-30-2005 03:43 PM
chmod -R question spooge Linux - General 2 01-13-2005 03:58 PM
chmod Question Rawr101 Linux - General 1 09-19-2004 04:17 AM
Question regarding chmod Yohhan Linux - Software 3 01-26-2003 03:24 AM > Forums > Linux Forums > Linux - Newbie

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

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