LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 10: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, 10: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: 67
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 10:24 AM.
 
Old 12-08-2004, 10: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, 10: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: 67
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, 10: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, 10: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: 67
Sorry, that is my bad. You need execute permissions.. try chmod 775 just to be sure.
 
Old 12-08-2004, 10: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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:59 AM.

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
Open Source Consulting | Domain Registration