Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Folder / File permission on Ubuntu Linux problem

Posted on 2012-03-23
9
Medium Priority
?
496 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
Industry Leaders: 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 1400 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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…
Suggested Courses
Course of the Month9 days, 10 hours left to enroll

877 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