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
Permission? rahulrathod UNIX for Dummies Questions & Answers 1 02-13-2006 09:31 AM
permission dozy UNIX for Dummies Questions & Answers 1 12-28-2004 08:00 AM
permission help eloquent99 UNIX for Dummies Questions & Answers 2 02-12-2003 01:30 AM
su permission siavoush UNIX for Dummies Questions & Answers 12 06-15-2002 08:56 PM
Ftp permission 644 cagnod UNIX for Advanced & Expert Users 4 04-10-2002 03:42 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 03-27-2006
Registered User
 

Join Date: Jan 2006
Posts: 145
Unhappy Permission 711---RWX---X---X

I have a file with permisson 711; but when an other user run the program, it can't open. This is the message:

/sbin/sh: ./myprogram: cannot open

Can any1 tell me why please?

Thanks!
Reply With Quote
Forum Sponsor
  #2  
Old 03-27-2006
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,614
That "myprogram" file must be a shell script. Shells need to read a file to execute it.
Reply With Quote
  #3  
Old 03-28-2006
Registered User
 

Join Date: Jan 2006
Posts: 145
Unhappy

I have a file with permisson 711; but when an other user run the program, it can't open. This is the message:

/sbin/sh: ./myprogram: cannot open

Can any1 tell me why please?


Thanks!


#2 1 Day Ago
Perderabo
Unix Daemon Join Date: Aug 2001
Location: Rockville Md
Posts: 5,439

That "myprogram" file must be a shell script. Shells need to read a file to execute it.

Question:

Is this mean in the beginning of the program I have to have:


/sbin/sh

codes
codes
codes
.......

Thanks!
Reply With Quote
  #4  
Old 03-28-2006
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,614
See our faq area for a discussion of the "#!" line and what happens without it. But to the shell, which is a program, a shell script is a data file. The only way a program can know what is in a data file is by reading the data file. There is no magic data that can be placed in a data file to change this fact.
Reply With Quote
  #5  
Old 03-29-2006
Registered User
 

Join Date: Mar 2006
Location: Buenos Aires
Posts: 10
Quote:
Originally Posted by Perderabo
See our faq area for a discussion of the "#!" line and what happens without it. But to the shell, which is a program, a shell script is a data file. The only way a program can know what is in a data file is by reading the data file. There is no magic data that can be placed in a data file to change this fact.
Sorry to get in the middle. I'm trying to learn us much as I can from this forum, so I keep jumping from thread to thread (of course most of them don't make sense to me as I am a newbie)
I went to FAQ section, and read the thread (nice!), but I came up with one question regarding permissions: would it work if the script file had "read" permission but not "execute"? I'm sorry to make such questions, but I'm currently learning UNIX theoretical aspects, as I have limited access to the system.
Thanks,
panchopp.
Reply With Quote
  #6  
Old 03-29-2006
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,614
Without execute permission, the kernel will refuse to execute it. It depends on the shell if you can do stuff like:
shell shellscript
However if the file is already open, the shell will no way to check. So this will work with read permission only with any shell:
shell < shellscript
I do that with one-time shellscripts...it saves a few keystrokes and makes it unlikey that I will accidentally rerun the script.
Reply With Quote
  #7  
Old 03-29-2006
Registered User
 

Join Date: Mar 2006
Location: Buenos Aires
Posts: 10
I see... good info, txs!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:37 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