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
Solved

Folder / File permission on Ubuntu Linux problem

Posted on 2012-03-23
9
491 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
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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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 6

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
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…
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.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

809 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