negative permissions


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers negative permissions
# 1  
Old 10-08-2006
negative permissions

Hi.

I want to know how can I negate a write permission for a file to an expecific user when that user have that permission becouse he belongs to a group what have a write permission for the file.
# 2  
Old 10-08-2006
Create a second group that comtains all of the members of the first group except for this particular user. Then let the second group have write permission to the file.
# 3  
Old 10-09-2006
i am having almost the same problem here too....

how to specify specify the type of negative permission in Unix/Linux:
-without using ACLs,
-using ACLs ?

what are :
-the commands issued to set the permissions,
-the permissions before and after those commands,

thanks...!!!
# 4  
Old 10-09-2006
I tried to use ACLs to restrict user privileges, and found that a user that is explicitly denied write perms in a file's ACLs will not be able to write to a file even if the group that the user belongs to has write permissions on that file.

I created a user test having group test, and created a file named testfile that has write permissions for the group test but is owned by root.
Code:
# id test
uid=1000462(test) gid=65546(test)
# ls -l testfile
-rw-rw-r--   1 root     test          10 Oct 10 10:17 testfile

OS: Solaris 8 -
I set the ACLs on the file to allow the user test to only read the file. Mask set to rwx.
Code:
# setfacl -m u:test:r--,m:rwx testfile
# ls -l testfile
-rw-rw-r--+  1 root     test          10 Oct 10 10:17 testfile
# getfacl testfile

# file: testfile
# owner: root
# group: test
user::rw-
user:test:r--           #effective:r--
group::rw-              #effective:rw-
mask:rwx
other:r--

Next, I tried to write to the file as user test.
Code:
$ id
uid=1000462(test) gid=65546(test)
$ ls -l testfile
-rw-rw-r--+  1 root     test          10 Oct 10 10:17 testfile
$ cat >> testfile
ksh: testfile: cannot create

I also tried this on HP-UX, vxfs:
Code:
# setacl -m u:test:r-- testfile
# ls -l testfile
-rw-rw-r--+  1 root       users            9 Oct 10 07:58 testfile
# getacl testfile
# file: testfile
# owner: root
# group: users
user::rw-
user:test:r--
group::rw-
class:rw-
other:r--

When I su-ed to user test and tried to write to the file,
Code:
$ id     
uid=111(test) gid=20(users)
$ cat >> testfile
sh: testfile: Cannot create the specified file.

If your filesystem supports ACLs you can probably use them to restrict users from writing to a file even if they are part of a group that has write permissions on the file.
# 5  
Old 10-12-2006
Thank you very much....
with these commands, things are going well. Smilie

cheers...!!!!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Negative decimal to binary

Is there a fast way to convert a negative decimal value into a signed binary number in bash script ? I've looked a lot on internet but I saw nothing... (For exemple : -1 become 11111111.) (9 Replies)
Discussion started by: Zedki
9 Replies

2. Post Here to Contact Site Administrators and Moderators

Bits in Negative

Hi All, I have received a notification that I have posted a question double times. But I have not done all this intentionally. I have just joined this site and was not aware of the rules. Also I have my bits in negative. what does that mean. Thanks (1 Reply)
Discussion started by: Palak Sharma
1 Replies

3. Shell Programming and Scripting

Grep for the most negative number

Hello, I am trying to write a bash script which will give me the most negative number. Here is an example input: Ce 3.7729752124 -4.9505731588 -4.1061257680 Ce -6.9156611391 -0.5991784762 7.3051893138 Ce 7.6489739875 0.3513020731 ... (6 Replies)
Discussion started by: sdl27789
6 Replies

4. Shell Programming and Scripting

change value to negative

How to change value in column 5 to negative based on value in column 2 ? Example: For all records with A in column 2 change value in column 5 to negative. file Code: 1234~A~b~c~10~e~f~g~h~09/10/09 1234~A~b~c~75~e~f~g~h~11/12/10 1234~A~b~c~40~e~f~g~h~12/06/10 5678~B~b~c~2~e~f~g~h~01/11/11... (4 Replies)
Discussion started by: sigh2010
4 Replies

5. Shell Programming and Scripting

PCRE negative lookahead

I have read many tutorials and cannot get this to work. I need to use pcre (because that is what the library in the software we are using uses) and pcregrep everything except /home from the /etc/fstab pcregrep '(?!/home)' /etc/fstab It returns the entire fstab (This is on a RHEL5... (1 Reply)
Discussion started by: insania
1 Replies

6. Shell Programming and Scripting

replace space with + and - as negative only

I have a file file1.dat with the following lines 22885068900000652 B86860003OLFXXX592123320081227 22885068900000652 B86860003ODL-Sp592123420081227 22885068900000652-B94030001ODL-Ch592123520081227 23666483030000653-B94030001ODL-Ch000000120081227 23797049900000654-E71060001OLFXXX000000220081227... (3 Replies)
Discussion started by: kshuser
3 Replies

7. Shell Programming and Scripting

Grep for a negative number

Hi, I want to search for a return code of -3. Using grep "-3" *.* is giving a syntax error. Please suggest as to how can we search for this pattern using grep. Thanks, Krishna (2 Replies)
Discussion started by: kzmatam
2 Replies

8. Shell Programming and Scripting

report negative value from file

Hello, I need help to write a script to do the following: 1) read the following file vol_check.out 2) report any negative value with host and volume name vol_check.out file contents: ---------------------------------- prod_filer1 ---------------------------------... (2 Replies)
Discussion started by: za_7565
2 Replies

9. Programming

Negative Offset

Function: int fcntl(int fd, int cmd, struct flock * lock) Data Type: struct flock This structure is used with the fcntl function to describe a file lock. It has these members: off_t l_start This specifies the offset of the start of the region to which the lock applies, and... (1 Reply)
Discussion started by: DNAx86
1 Replies
Login or Register to Ask a Question