Tricky File Permission Question

Thread Tools Search this Thread
Special Forums Hardware Filesystems, Disks and Memory Tricky File Permission Question
# 1  
Old 06-30-2002
Tricky File Permission Question

I'm trying to answer the following question about file permissions in Unix. Consider a file with the following permissions:


I am not the owner of this file, but I am a member of the group of this file.

My question is: do I have read access to this file?

I thought the answer was YES, since the world has read access to this file. But, a sysadmin is telling me that the answer is NO, since the group access bits are all off.

Can someone provide an authoritative answer?

I would try to answer this for myself, but at the moment, I don't have access to a Unix box with sufficient priveleges.


# 2  
Old 06-30-2002
If your kernel is working correctly, you should be unable to read the file. This behavior is mandated by Posix and all posix compliant systems should behave this way.

Which way this should work was debated during the early 80's. The overriding element was that rwx---r-- and rwxr--r-- really should behave differently. The currently accepted behavior allows a user to revoke permission for one group while allowing all other groups access. If you want rwxr--r-- then all you need is a chmod to get it.
# 3  
Old 07-01-2002
Re: Tricky File Permission

Thanks for the reply. I was hoping this was the answer.

Can you point me at a source that describes this behavior?

# 4  
Old 07-16-2002
Question File permissions rwx---r--

The way Unix handles the permission is by reading the permission from the left to the right.
If the permission looks like rwx---r--
And you are not the owner but are a group member you cannot read this file.
##############Demo on HP-UX 11i, Logged on as rene
Home dir /home/rene
$ id
uid=102(rene) gid=20(users)
$ ls -la
total 14
drwxr-xr-x 2 rene users 1024 Jul 16 21:17 .
drwxr-xr-x 4 root root 96 Jul 9 23:13 ..
-rw-r--r-- 1 rene users 832 Jul 9 23:13 .cshrc
-rw-r--r-- 1 rene users 347 Jul 9 23:13 .exrc
-rw-r--r-- 1 rene users 334 Jul 9 23:13 .login
-rw-r--r-- 1 rene users 439 Jul 9 23:13 .profile
-rw------- 1 rene users 146 Jul 16 21:22 .sh_history
-rwx---r-- 1 root users 32 Jul 16 21:19 permtest
$ cat permtest
cat: Cannot open permtest: Permission denied
# Permissions are read from the left to the right and it first tells that the group users have NO permissions bits set.
-- I hope this helps
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

File Permission question

Experts: i want to change this permission back to the way it was: Initial: drwxr-xr-x 8 oracle oinstall 4096 Jun 5 15:21 oracle Now: drwxr-xr-x 8 oracle oinstall 4096 Jun 5 15:21 oracle drwsr-sr-x 8 oracle oinstall 4096 Jun 5 15:21 oracle Now I want to switch it back to ... (2 Replies)
Discussion started by: sumang24
2 Replies

2. Shell Programming and Scripting

Tricky BASH quoting question

I have some data files that I can identify by a certain pattern in the names using find. Every one of those data files has an XML file associated with it (can be multiple data files per XML file). The XML file is always up one directory from the data file(s) in a folder calledRun##### -... (12 Replies)
Discussion started by: Michael Stora
12 Replies

3. UNIX for Dummies Questions & Answers

Tricky GREP question..

I have some large login files that I need to extract (user)@(server) from. Where it gets tricky is that there is usually more than one '@' sign on each line(although it does have a leading space if it's not part of the (user)@(server) string), I need only the (user)@(server) section, I need only... (6 Replies)
Discussion started by: Mordaris
6 Replies

4. UNIX for Dummies Questions & Answers

Simple question on unix file permission

As I understand the file permissions in UNIX is basically Owner, group, others Lets assume scott user who's primary group is dev creates a file called test.dat and then grants some privileges on that file... scott@unix-host> echo "this is a test" > test.dat scott@unix-host> chmod 640... (4 Replies)
Discussion started by: luft
4 Replies

5. Shell Programming and Scripting

create csv in ksh from tricky log file

hi guys, trying to create a csv from a tricky log file in ksh, using 'awk '{print $1" "$14" "$15" "$16" "$17" "$18" "$19}' >> $TMP_FILE' on another set of files I have an output file with hundreds of lines in which looks like so: ABC_DEFGHI_16_JKLMNP11.20101115_095412_374.log:09:54:29.579... (3 Replies)
Discussion started by: rich@ardz
3 Replies

6. Shell Programming and Scripting

Another tricky sed or awk question

This post is in reference to I am trying to go the opposite direction now: I have the following file: a,b,C,f,g a,b,D,f,g a,b,E,f,g h,i,J,k,l m,n,O,t,u m,n,P,t,u m,n,Q,t,u... (3 Replies)
Discussion started by: awayand
3 Replies

7. Shell Programming and Scripting

Tricky sed or awk question

Hello everyone, unfortunately I am no unix nor scripting guru, which is why I am asking for help here. I am trying to reformat a .csv file using sed or awk which has the following format: a,b,C-D-E,f,g h,i,J,k,l m,n,O-P-Q-R-S,t,u v,w,X-Y,z,a It's basically a 5-field text file which has an... (7 Replies)
Discussion started by: awayand
7 Replies

8. UNIX for Dummies Questions & Answers

tricky file output

I have a following file, I want to output 2 files. Is that easy to do? Output 1 output2 Thanks (4 Replies)
Discussion started by: jbchen
4 Replies

9. UNIX for Dummies Questions & Answers

Tricky Quotation Question

Hi, I am at a point in my script where I defined the number of the command line parameter I would like to set a variable equal to: parameter_number=14 I would then like to set a variable equal to the correct parameter: variable=$parameter_number The issue here is that {} is required... (2 Replies)
Discussion started by: msb65
2 Replies

10. Shell Programming and Scripting

Tricky script question

Hi, I'm in the midst of writing a UNIX script that sftp's files to an external host and am stuck with a problem. The problem is that the files created on my server as a order number that correlates to a sequence of directories on the remote host which is where the file should be ftp'ed. ... (3 Replies)
Discussion started by: budrito
3 Replies
Login or Register to Ask a Question