The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
copy a fs with the same privileges itik AIX 3 05-08-2008 11:09 AM
root privileges madmat UNIX for Dummies Questions & Answers 4 04-16-2008 03:00 AM
ACL vs privileges heroine UNIX for Dummies Questions & Answers 1 12-29-2006 07:19 PM
root privileges sumsin High Level Programming 21 12-30-2005 12:43 PM
privileges paladaxar UNIX for Dummies Questions & Answers 1 11-02-2005 05:28 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 01-17-2006
Registered User
 

Join Date: Sep 2005
Posts: 85
Giving others execute privileges

I'm trying to give everyone execute privileges on one of my small scripts. BUT, I don't want them to be able to view the file, just execute it.

As USER1, I have:
/usrhome/ncora/script_test CDS> $ls -la
drwxrw-rw- 2 ncora ncd 96 Jan 13 15:58 .
drwxrwxrwx 7 ncora ncd 2048 Jan 17 08:55 ..
-rwx-----x 1 ncora ncd 59 Jan 17 08:57 script1.sh
-rwx-----x 1 ncora ncd 76 Jan 13 15:50 script2.sh


But, as USER2, if I try:

./usrhome/ncora/script_test/script1.sh

i get:
sh: /usrhome/ncora/script_test/script2.sh: Cannot find or open the file.

Why can't USER2 execute USER1's script??

Thanks!
Reply With Quote
Forum Sponsor
  #2  
Old 01-17-2006
Registered User
 

Join Date: Nov 2003
Location: Minnesota
Posts: 388
Does USER2 have permissions to the directory the script is in? I would guess from the "cannot find or open the file" message that they don't and therefore they can't see the script to run it.
Reply With Quote
  #3  
Old 01-17-2006
Registered User
 

Join Date: Nov 2001
Location: Flint, MI
Posts: 185
You might try placing a space between the . and the first / like this:
. /usrhome/ncora/script_test/script1.sh
Reply With Quote
  #4  
Old 01-18-2006
Registered User
 

Join Date: Sep 2005
Posts: 85
I gave everyone read permissions to the directory. Now when USER2 goes to that directory he sees:

$ ls -la
total 8
drwxrwxrwx 2 ncora ncd 96 Jan 17 09:07 .
drwxrwxrwx 7 ncora ncd 2048 Jan 17 23:55 ..
-rwx--x--x 1 ncora ncd 59 Jan 17 08:57 script1.sh
-rwx--x--x 1 ncora ncd 76 Jan 13 15:50 script2.sh


But I can't seem to be able to execute the script. Is it not possible to have X without R??

Thanks!
Reply With Quote
  #5  
Old 01-18-2006
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,326
First of all, remove the world writable permission from '.' and '..'. You do *not* need that. When you showed the 'ls -la' output in the first post, the problem was that others did not have rights to browse the directory (the x for others was missing from the permissions for .).
If you still are unable to run the script, that is quite surprising. What is the error message that you are getting?
Reply With Quote
  #6  
Old 01-18-2006
Registered User
 

Join Date: Sep 2005
Posts: 85
This is what I get now:

$ echo $SHELL
/usr/bin/sh
$
$ ls -la
total 8
drwxrwxr-x 2 ncora ncd 96 Jan 17 09:07 .
drwxrwxr-x 7 ncora ncd 2048 Jan 17 23:55 ..
-rwx--x--x 1 ncora ncd 59 Jan 17 08:57 script1.sh
-rwx--x--x 1 ncora ncd 76 Jan 13 15:50 script2.sh
$ ./script1.sh
/usr/bin/sh: ./script1.sh: Cannot find or open the file.
$
Reply With Quote
  #7  
Old 01-18-2006
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,326
Is the first line of the file script1.sh "#!/usr/bin/sh" or is it "#!/bin/sh". If it is /usr/bin/sh/ksh/csh, does the file exist?
I have got similar errors before on Linux and BSD systems where the /bin directory is an actual directory and not a symlink to /usr/bin. If that is the case, then /bin/sh exists but not /usr/bin/sh.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:11 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0