Solved

Folder / File permission on Ubuntu Linux problem

Posted on 2012-03-23
9
492 Views
Last Modified: 2012-03-26
Hi,

I created a website and put all html files on one folder e.g. /var/www, everything is fine on initial stage because I always use sudo <command>

Then,  there are two admin users user1 and user2, I grant the folder permission for the /var/www as below command:

sudo chown -R root:admin /var/www
sudo chmod -R 664 /var/www

So the problem is, when I use as "user1" ID upload files to that folder, user2 cannot modify my created files or folders, i check that the file permission status as below

under /var/www/
drwxr-xr-x   user1  user1      4096 2012-03-22 16:27 stylesheets/
-rw-r--r--      user1  user1       787 2012-03-23 11:12 index.html

So how can two admin users modify all the files in that folder?
0
Comment
Question by:liyy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 17

Expert Comment

by:Sikhumbuzo Ntsada
ID: 37756211
0
 
LVL 5

Expert Comment

by:1ly4me
ID: 37756545
try
#chgrp -R admin /var/www
(both user1 and user2 must be group members of Admin)
0
 
LVL 31

Expert Comment

by:farzanj
ID: 37756623
So do you want them to be able to modify file/permissions or are just wondering as to what happened and how they managed to change file/permissions?

If you want to them to be able to change, you can allow permissions through ACLs which provide customized granularity.

If you are wondering how they changed, there may be multiple ways.  What is the directory just above where they made changes?  So supposed they changed a file X in
/var/www/A/B/X, I want to see permissions of B.  Also, do they have sudo access?

If those files are directly under www, then issue command
getfacl /var/www
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:liyy
ID: 37757338
user1 and 2 have already admin. group, and /var/www already be set.

I want to allow user1 and user2 can update all files including sub folders and files under /var/www

user1 and user2 will not use sudo because they will use Filezilla to upload the files, they cannot login as root on Filezilla
0
 
LVL 7

Expert Comment

by:torakeshb
ID: 37757431
Make the UID of user1 and user2 same by editing the /etc/passwd file.
0
 
LVL 31

Expert Comment

by:farzanj
ID: 37759565
If user1 and user2 are already in group admin, they should be able to do a lot of things with files.  They can do a lot of things to the files/folders owned by the group admin.  But the group permissions of the parent folder should be 7. What they cannot do is running chmod or chgrp kind of commands.  These commands require to be either the owner or root.

Another way is to use ACL.  So you can allow like

setfacl -m u:user1:rwx /path/folder/or/file
0
 

Author Comment

by:liyy
ID: 37763990
OK, let me try it and feedback here.
0
 

Author Comment

by:liyy
ID: 37764445
I use "sudo setfacl -m g:admin:rwx /path/folder" is OK, but existing sub-folders will also be executed setfacl again!
0
 
LVL 31

Accepted Solution

by:
farzanj earned 350 total points
ID: 37765653
For recursively implementing permissions you can use -R.

setfacl -R -m ...

Also understand that giving a group permission is not same a giving user permission.  As I said before, some of the functions can only be done by user permission not group permission like chmod.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question