Solved

Redhat - ACL

Posted on 2013-01-08
22
627 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
ID: 38757584
Try this:

setfacl -m u:dave:rwx .

touch file1

ls -l file1

What are the permissions of file1?
0
 

Author Comment

by:ittechlab
ID: 38757590
[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
ID: 38757593
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
ID: 38757600
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
ID: 38757618
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
ID: 38757621
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
ID: 38758625
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
ID: 38758711
@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
ID: 38758839
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
ID: 38758891
@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
ID: 38758894
setfacl -m user:dave:wx test

what is mean then? I am I not giving dave to create contents in test folder.
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 31

Expert Comment

by:farzanj
ID: 38758925
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
ID: 38758929
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
ID: 38758939
doesnt the file need to be owned by someone other than root then?
0
 

Author Comment

by:ittechlab
ID: 38758944
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
ID: 38758957
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
ID: 38758965
@Jools: are you asking me?  If so, elaborate your question.  Otherwise please disregard this comment.
0
 

Author Comment

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

Expert Comment

by:farzanj
ID: 38758991
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
ID: 38759259
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
ID: 38759489
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
ID: 38759622
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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Suggested Solutions

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
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…
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…

911 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

21 Experts available now in Live!

Get 1:1 Help Now