Sponsored Content
Special Forums Hardware Filesystems, Disks and Memory Tricky File Permission Question Post 24687 by rene_metaal on Tuesday 16th of July 2002 03:25:46 PM
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.
So
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
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. Shell Programming and Scripting

Another tricky sed or awk question

This post is in reference to https://www.unix.com/shell-programming-scripting/137977-tricky-sed-awk-question-post302428154.html#post302428154 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

6. 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

7. 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

8. 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

9. 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

10. 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
CHMOD(1)						      General Commands Manual							  CHMOD(1)

NAME
chmod - change access mode for files SYNOPSIS
chmod [-R] mode file ... OPTIONS
-R Change hierarchies recursively EXAMPLES
chmod 755 file # Owner: rwx Group: r-x Others: r-x chmod +x file1 file2 # Make file1 and file2 executable chmod a-w file # Make file read only chmod u+s file # Turn on SETUID for file chmod -R o+w dir # Allow writing for all files in dir DESCRIPTION
The given mode is applied to each file in the file list. If the -R flag is present, the files in a directory will be changed as well. The mode can be either absolute or symbolic. Absolute modes are given as an octal number that represents the new file mode. The mode bits are defined as follows: 4000 Set effective user id on execution to file's owner id 2000 Set effective group id on execution to file's group id 0400 file is readable by the owner of the file 0200 writeable by owner 0100 executable by owner 0070 same as above, for other users in the same group 0007 same as above, for all other users Symbolic modes modify the current file mode in a specified way. The form is: [who] op permissions { op permissions ...} {, [who] op ... } The possibilities for who are u, g, o, and a, standing for user, group, other and all, respectively. If who is omitted, a is assumed, but the current umask is used. The op can be +, -, or =; + turns on the given permissions, - turns them off; = sets the permissions exclu- sively for the given who. For example g=x sets the group permissions to --x. The possible permissions are r, w, x; which stand for read, write, and execute; s turns on the set effective user/group id bits. s only makes sense with u and g; o+s is harmless. SEE ALSO
ls(1), chmod(2). CHMOD(1)
All times are GMT -4. The time now is 03:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy