Testing permission


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Testing permission
# 1  
Old 12-16-2007
Testing permission

One question to test the permission

I know test commands give us:
test -w filename - to test if file exists and writeable
test -x filename - to test if file exists and executable
test -r filename - to test if file exists and readable

How do I test if the permission is writeable or readable or executable by group users and everybody? As far as I know -w -x -r is to test for owners, am I right?
# 2  
Old 12-16-2007
Quote:
Originally Posted by felixwhoals
As far as I know -w -x -r is to test for owners, am I right?
No, it tests whether the current user has that right. Which may be through owning the file, or by being in the right group for somebody elses file, or by the file have the appropriate world rights.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Ip up/down testing

#!/bin/bash ip=$1 if ; then echo "U must enter ip as argument: $0 " exit 1 fi testip=`echo $ip |grep -E "^((||1{2}|2|25)){3}(||1{2}|2|25)$"` if ; then echo "Wrong ip adress" exit 2 fi ping -c 2 $ip 2>&1 >/dev/null if ; then echo "$ip is UP" else echo "$ip is... (2 Replies)
Discussion started by: aco4u
2 Replies

2. UNIX for Advanced & Expert Users

Testing privileges -lock lockfile /var/lock/subsys/..- Permission denied

Hi all, I have to test some user priviliges. The goal is to be sure that an unauthorized user can't restart some modules (ssh, mysql etc...). I'm trying to automate it with a shell script but in same cases I got the syslog broadcast message. Is there any way to simply get a return code... (3 Replies)
Discussion started by: Dedalus
3 Replies

3. UNIX for Dummies Questions & Answers

testing

first time use (0 Replies)
Discussion started by: lcharles
0 Replies

4. UNIX for Advanced & Expert Users

testing

what is the difference between white box and black box testing? (1 Reply)
Discussion started by: areef4u
1 Replies

5. UNIX for Advanced & Expert Users

testing

what does one mean in the context of testing... UNIT TESTING & INITIAL LEVEL OF MENU TESTING (2 Replies)
Discussion started by: areef4u
2 Replies
Login or Register to Ask a Question