LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices



Reply
 
Search this Thread
Old 12-08-2004, 11:01 AM   #1
imsam
Member
 
Registered: Dec 2003
Posts: 64

Rep: Reputation: 15
Question Need help setting permissions for a directory


Hi,

I created a user group called ftp-users. Now I'd like to give this group read and write permissions to /var/www/html directory.

I'd appreciate your help with this.
 
Old 12-08-2004, 11:08 AM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 66
chgrp ftp-users /var/www/html
chmod 760 /var/www/html

Just to give you a break down on chmod

There are three numbers (in this case 7, 6, and 0).

The first number designates the permissions for the owner of the file/directory.

Second is the owning group.

Third is everyone else.

Each number is really three bits, rwx. Just read permissions is the bits 100 (4), just write is 010 (2), just execute 001 (1). If you want to give execute and read you add execute and read together and you get 5. If you want to give both read and write it would be 6, and so on.

So 760 as I have in my example is read, write and execute for the owner, read and write for the owning group (which was changed to ftp-users with the chgrp command), and all other users have no access to this directory.

I hope this wasn't too confusing.

Last edited by jtshaw; 12-08-2004 at 11:24 AM.
 
Old 12-08-2004, 11:17 AM   #3
imsam
Member
 
Registered: Dec 2003
Posts: 64

Original Poster
Rep: Reputation: 15
Thank you very much

jtshaw,

Wow... I can't thank you enough. You gave me a lot more than I expected and your explanation is perfect. Thanks again.

If I can squeeze one more question: if I change the owner of the group, that wouldn't affect root right? root will always have full access to that folder. Is this a correct assumption?
 
Old 12-08-2004, 11:23 AM   #4
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 66
Yes, root always has permissions to everything. Root can also always run chmod and chown/chgrp on a file regardless of its current permissions.

A user can only change the permissions of a file if it owns the file.
 
Old 12-08-2004, 11:28 AM   #5
imsam
Member
 
Registered: Dec 2003
Posts: 64

Original Poster
Rep: Reputation: 15
Question Getting a weird error now

Hi,

After executing those two commands, I can no longer ftp into the site.

I have a user called myftpaccount which is a member of ftp-users group and in the /etc/passwd file I had changed the home directory for this user to /var/www/html.

When I tried to ftp into my site from a windows machine's command line, I got the following errors:
500 OOPS: Cannot change directory:/var/www/html
500 OOPS: Chield died

I tried ftping into the site on the linux machine and got the following error message:
500 OOPS: Cannot change directory:/var/www/html
Login failed

What have I done wrong?
 
Old 12-08-2004, 11:31 AM   #6
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 66
Sorry, that is my bad. You need execute permissions.. try chmod 775 just to be sure.
 
Old 12-08-2004, 11:37 AM   #7
imsam
Member
 
Registered: Dec 2003
Posts: 64

Original Poster
Rep: Reputation: 15
Thanks again

jtshaw, thanks again. That fixed the problem. Now I can upload/delete files and create subdirectories. Thank you.
 
  


Reply


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
setting directory permissions at start redrobin77 Fedora 1 11-05-2005 02:26 PM
trouble setting directory permissions goodolday Linux - General 1 04-26-2005 05:06 PM
Setting permissions for directory ch4s3r Linux - Software 5 08-19-2004 04:37 PM
Automatically Setting File Permissions in a Directory maneeshsethi Linux - Security 2 05-27-2004 08:42 PM
Setting Directory Permissions is Hard ! dpaille Linux - General 1 12-12-2002 02:03 PM


All times are GMT -5. The time now is 02:46 PM.

Main Menu
Advertisement
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