Solved

Folder / File permission on Ubuntu Linux problem

Posted on 2012-03-23
9
488 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
 

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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.:

746 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now