Solved

Redhat - ACL

Posted on 2013-01-08
22
621 Views
Last Modified: 2013-03-19
[dave@desktop5 test]$ ls -ld .
drwxr-xr-x+ 2 root root 4096 Jan  8 18:22 .
[dave@desktop5 test]$ getfacl .
# file: .
# owner: root
# group: root
user::rwx
group::r-x
other::r-x
default:user::rwx
default:user:dave:-wx
default:group::r-x
default:mask::rwx
default:other::r-x

[dave@desktop5 test]$ touch file1
touch: cannot touch `file1': Permission denied
[dave@desktop5 test]$

why i can't touch a file according to my permission.
0
Comment
Question by:ittechlab
  • 10
  • 10
  • 2
22 Comments
 
LVL 31

Expert Comment

by:farzanj
Comment Utility
Try this:

setfacl -m u:dave:rwx .

touch file1

ls -l file1

What are the permissions of file1?
0
 

Author Comment

by:ittechlab
Comment Utility
[root@desktop5 ~]# cd /var/lo
local/ lock/  log/
[root@desktop5 ~]# cd /var/log/test/
[root@desktop5 test]# setfacl -m u:dave:rwx .
[root@desktop5 test]# su - dave
[dave@desktop5 ~]$ cd /var/log/test/
[dave@desktop5 test]$ touch file1
[dave@desktop5 test]$ ls -l file1
-rw-rw-r--+ 1 dave dave 0 Jan  8 18:40 file1
0
 

Author Comment

by:ittechlab
Comment Utility
why wx didn't work?

others have r permission. isn't that going to help dave to create contents in the directory.


[dave@desktop5 test]$ ls -ld .
drwxrwxr-x+ 2 root root 4096 Jan  8 18:40 .
0
 
LVL 31

Expert Comment

by:farzanj
Comment Utility
Take a look at this:
ftp://ftp-uxsup.csx.cam.ac.uk/pub/doc/suse/suse9.0/adminguide-9.0/node27.html
It states:
Default ACL
Default ACLs can only be applied to directories. They determine the permissions a file system object inherits from its parent directory when it is created.


Dave only had default.  Didn't have actual permissions.  He was considered "others".
0
 

Author Comment

by:ittechlab
Comment Utility
default:user:dave:-wx

i am still not clear. this is what dave had according to your recent explanation right?
0
 
LVL 31

Expert Comment

by:farzanj
Comment Utility
Yes, this is NOT the permission for dave!  This is the default permission for files created.  Dave did not have any permissions.  Since the folder was owned by user and group root, dave was "others". I made special permission for dave.

Did you read the link above in detail?
0
 
LVL 19

Expert Comment

by:jools
Comment Utility
dont you just need to change the perms to 777 for the test directory or make dave the owner??

The original post test was owned by root and the directory only had permissions for root to write to it.
0
 
LVL 31

Expert Comment

by:farzanj
Comment Utility
@Jools:  Right, but with ACL, he can allow dave to any kind of permission without changing any ownership and that is what he is trying to do.  The only thing is the user permission in ACL and default permissions and two different concepts.
0
 

Author Comment

by:ittechlab
Comment Utility
based on my original post, dave had the following permission. Why he couldn't create a file.

default:user:dave:-wx
0
 
LVL 31

Accepted Solution

by:
farzanj earned 310 total points
Comment Utility
@ittechlab
Did you read the link I gave you above????

default:user:dave:-wx
IT IS NOT THE PERMISSION FOR dave.
Permission would appear like
user:dave:-wx

WITHOUT DEFAULT IN FRONT OF IT.  What is so confusing??  I fixed the issue for you, I gave you all the possible explanation and a related link. I even gave you the definition of defaults.  If you read the link above, it has more explanation.
0
 

Author Comment

by:ittechlab
Comment Utility
setfacl -m user:dave:wx test

what is mean then? I am I not giving dave to create contents in test folder.
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 31

Expert Comment

by:farzanj
Comment Utility
In your original post, I only saw user dave with default and NO PERMISSIONS.

>> I am I not giving dave to create contents in test folder.
Then take away the write permission not the read permission.  When he creates files/folders in a folder, he uses the write permission of the folder not the read permission.
0
 

Author Comment

by:ittechlab
Comment Utility
setfacl -m user:dave:wx /var/log/test/
setfacl: Option -m: Invalid argument near character 6


whats wrong with this?

cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.7 (Tikanga)
0
 
LVL 19

Expert Comment

by:jools
Comment Utility
doesnt the file need to be owned by someone other than root then?
0
 

Author Comment

by:ittechlab
Comment Utility
i fixed.

How come it works in redhat 5.7 and when i apply the same in redhat 6 it does not work.
0
 
LVL 31

Expert Comment

by:farzanj
Comment Utility
If you don't want dave to have write permissions, you don't need to do anything because he will be "others" and will be able to read and execute anyway.
0
 
LVL 31

Expert Comment

by:farzanj
Comment Utility
@Jools: are you asking me?  If so, elaborate your question.  Otherwise please disregard this comment.
0
 

Author Comment

by:ittechlab
Comment Utility
did something change with recent version, i didn't see deafult:user part before.
0
 
LVL 31

Expert Comment

by:farzanj
Comment Utility
No, ACLs are the same even in RHEL 4 and obviously 5 and 6.  Only that you have one machine with default and other with actual permissions.  In RHEL4 you had to remount partitions with ACL options.  In RHEL6 ACLs are enabled by default.
0
 

Author Comment

by:ittechlab
Comment Utility
i have redhat 6 and 5.7. when i tried to setup ACL the output was different. one didn't had default part.
0
 

Author Comment

by:ittechlab
Comment Utility
How come its working in 5.7.  If i apply same steps i don't see it works in redhat 6. I don't see any default stuff here.

[root@~]# useradd test
[root@~]# mkdir /var/log/testDir
[root@~]# ls -ld /var/log/testDir/
drwxr-x--- 2 root root 4096 Jan  9 11:11 /var/log/testDir/
[root@~]# setfacl -m user:test:wx /var/log/testDir/
[root@~]# su - test
[test@~]$ cd /var/log/testDir/
[test@testDir]$ touch file1
[test@testDir]$ getfacl .
# file: .
# owner: root
# group: root
user::rwx
user:test:-wx
group::r-x
mask::rwx
other::---
0
 
LVL 31

Expert Comment

by:farzanj
Comment Utility
I was able to issue the setfacl command on RHEL6.3 and get the expected outcome without default.  So I am not sure why it is happening with you as conceptually it shouldn't unless you specifically set the default  and I am able to work it correctly on RHEL6.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Automating a script for user accounts LINUX 14 39
My bash alias isn't executing 5 31
bash script question (chmod) 10 40
linux ssh 4 26
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…
In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

772 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

13 Experts available now in Live!

Get 1:1 Help Now