Solved

Folder / File permission on Ubuntu Linux problem

Posted on 2012-03-23
9
493 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Fine Tune your automatic Updates for Ubuntu / Debian
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

734 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