Problem related to file attribute (permissions) [message #231481] |
Tue, 17 April 2007 04:30 |
lalit.thawani
Messages: 11 Registered: April 2007
|
Junior Member |
|
|
Hi All..!
I have a small problem related to setting of permission of a file. If i set the following permission of a file---> -rwx--x---
using the command chmod 710 <filename>
My requirement (which is a valid one) is that i want the users in the group to execute the file but they should not read or write it.
Now when any other user in the group execute this file, he gets the following--> ksh: ./Top.sh: cannot open
(Top.sh happens to be my file name)
But when i change the permission of the file to -rwxr-x---, then they are able to execute. But my purpose is anyways defeated (as i dont want the group to read that file).
Is there a way out ?
|
|
|
|
Re: Problem related to file attribute (permissions) [message #232979 is a reply to message #232879] |
Tue, 24 April 2007 06:22 |
lalit.thawani
Messages: 11 Registered: April 2007
|
Junior Member |
|
|
Hi Andrew
Thanks for your effort. I got the concept of SUID.
But it seems that this does not work on HP-UX.
I created a simple wrapper script with permission of 4750 and permission of 700 on the actual script, but of no avail. The k shell throws the following error : cannot execute
I am looking into it ... will keep you posted. Will apreciate if u can test it at your end.
Thanks Again
|
|
|
|
|
Re: Problem related to file attribute (permissions) [message #233369 is a reply to message #233145] |
Wed, 25 April 2007 18:27 |
andrew again
Messages: 2577 Registered: March 2000
|
Senior Member |
|
|
I'm on 11i too.
usera>>uname -r
B.11.11
Note - I loose the SUID bits if I vi the file - so need to set them again. Try this:
From USER A:
------------
usera>>cat file1
#!/bin/ksh
file2
usera>>cat file2
#!/bin/ksh
echo this is file2
usera>>chmod 755 file1
usera>>chmod u+s file1
usera>>chmod g+s file1
usera>>chmod 700 file2
usera>>ll file*
-rwsr-sr-x 1 usera useragrp 27 Apr 25 16:12 file1
-rwx------ 1 usera useragrp 30 Apr 25 16:05 file2
files:
total 0
## file1 runs file2 OK from owner
usera>>file1
this is file2
From USER B:
------------
## also fine from other user
userb>>file1
this is file2
## but other user can't exec file2 directly
userb>>file2
ksh: file2: cannot execute
|
|
|
Re: Problem related to file attribute (permissions) [message #233388 is a reply to message #233369] |
Thu, 26 April 2007 00:21 |
lalit.thawani
Messages: 11 Registered: April 2007
|
Junior Member |
|
|
Hi Andrew ..
Thanks for the detailed explaination.
I had done the same earlier.
But agian i did precisely as you mentioned
lalit>>ll file1 file2
-rwsr-sr-x 1 lalit ai 6 Apr 26 10:09 file1
-rwx------ 1 lalit ai 21 Apr 26 10:10 file2
lalit>> file1
this is file2
aiops001>> file1
file1: file2: cannot execute
(the user aiops001 and lalit belong to the same group)
|
|
|