Script without read permission but execute the script


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Script without read permission but execute the script
# 1  
Old 01-06-2009
Script without read permission but execute the script

I have a script, except me no one can read the script but they can execute the script. Is it possible?
# 2  
Old 01-06-2009
No its not possible.
# 3  
Old 01-06-2009
I don't understand why impossible?

if the script's access permission is set as 411, whether the other users can execute the script?
# 4  
Old 01-06-2009
Quote:
Originally Posted by mosaic
I don't understand why impossible?

if the script's access permission is set as 411, whether the other users can execute the script?
Just 'x' perm is not enough to execute a script/bin both 'r' and 'x' are needed

It cannot run without reading it
# 5  
Old 01-06-2009
but i have tried on the platform AIX 5.3. it can be executed by another user in the same group. therefore i'm confused.
# 6  
Old 01-06-2009
I also think this is not possible. Here is a test on my linux machine:
Code:
root@bastila:~/work# cat hello.sh
#!/bin/sh

echo Hello
root@bastila:~/work# chmod 701 hello.sh
root@bastila:~/work# ls -l hello.sh
-rwx-----x 1 root root 22 2009-01-06 15:24 hello.sh
root@bastila:~/work# exit
exit
tsurko@bastila:~/work$ ./hello.sh
/bin/sh: Can't open ./hello.sh

# 7  
Old 01-06-2009
It is possible by using the suid bit. The script will be run under your id and not the user's one which might be risky though.
Code:
# cat hi.ksh
#!/bin/ksh -p
echo hello
# chmod 04711 hi.ksh
# ls -l hi.ksh
-rws--x--x   1 jlliagre root          25 janv  6 17:02 hi.ksh
# su guest
$ ./hi.ksh
hello
$ cat hi.ksh
cat: cannot open hi.ksh: Permission denied

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find list of files missing read & execute permission

Hi, I'm writing a post-upgrade script and I want to find which files don't have read and execute to everyone. I can run a find . ! -perm, but then I have to use a list of the possible permissions (777,775, 755 etc). Is there a more elegant solution? Thanks (2 Replies)
Discussion started by: Catullus
2 Replies

2. Shell Programming and Scripting

Batch script to execute shell script in UNIX server

Hi team, My requirement is to transfer pdf files from windows machine to unix server and then from that unix server we should sftp to another server. I have completed the first part i.e From windows to using to unix server with the help of psftp.exe code: psftp user@host -pw password <... (1 Reply)
Discussion started by: bhupeshchavan
1 Replies

3. Shell Programming and Scripting

Execute permission for shell script

Hi All, I am not able to figure out what is the problem with calling a shell script within a shell script. i have given all the permissions to both schell scripts. but when i am seeing the log file error is coming like weekly_us_push_rpts_tst.sh: ./vacation_quota_summary_detail.sh: Execute... (9 Replies)
Discussion started by: krupasindhu18
9 Replies

4. UNIX for Advanced & Expert Users

Allow user without dir write permission to execute a script that creates files

In our project we have several unix scripts that trigger different processes. These scripts write logs to a particular folder 'sesslogs', create output data files in a separate directory called 'datafiles' etc. Usually L1 support team re-run these scripts . We donot want L1 support team to have... (14 Replies)
Discussion started by: waavman
14 Replies

5. Solaris

Script running even after execute permission removed.

Hi All, I'm new to solaris and this site but the advices in this site have helped me a lot. Today i am facing a new issue. We have a script for BMCDashboard and this script is not supposed to run evrytime the server is booted so we disabled the services and removed the execute... (7 Replies)
Discussion started by: Rockyc3400
7 Replies

6. Shell Programming and Scripting

perl script to check read/write/execute permission for 'others'

I want to check access rights permissions not for 'user', not for 'group', but for 'others'. I want to do it by system command in which i want to use 'ls -l' and 'awk' command. I have written the following program : #!/usr/bin/local/perl #include <stdlib.h> system ("ls -l | awk... (1 Reply)
Discussion started by: shubhamsachdeva
1 Replies

7. Programming

CGI Perl script to execute bash script- unable to create folder

Hi I have a bash script which takes parameters sh /tmp/gdg.sh -b BASE-NAME -n 1 -s /source/data -p /dest/data/archive -m ARC gdg.sh will scan the /source/data and will move the contents to /dest/data/archive after passing through some filters. Its working superb from bash I have... (0 Replies)
Discussion started by: rakeshkumar
0 Replies

8. Shell Programming and Scripting

Dos batch script to execute unix shell script

Can anyone help me with a dos batch script to execute a shell script residing in an unix server. I am not able to use ssh. Thanks in advance (2 Replies)
Discussion started by: Shri123
2 Replies

9. Shell Programming and Scripting

Execute unix shell script to text file using the script

Hi all, I am beginner in UNIX...I want to use unix shell script to create text.file...I know how to use using by command...can anybody tell me for the script? Thanks i changed the threads title from "tex file" to "text file", because "tex" would probably be misunderstood as reference to... (4 Replies)
Discussion started by: mastercar
4 Replies

10. Shell Programming and Scripting

How to execute a script without giving x permission to the file?

How to execute a script with out giving x permission to the file? (7 Replies)
Discussion started by: praveen_b744
7 Replies
Login or Register to Ask a Question