08-24-2015
This is not possible with regular unix permissions. In order for a user to be able to execute a script he needs to able to read it.
You may probably be able to accomplish this using sudo
Another method is to obfuscate the script with a script "compiler", which would however not stop a determined user and offers no real security...
Last edited by Scrutinizer; 08-24-2015 at 11:37 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi folks,
Need your help.
I am writing a KSH script to read a few commands from a file & execute.
I am using the following code to read the file line by line & excute each command. When I am printing each line I see it is printing properly but while excuting, the particular "ps" command... (5 Replies)
Discussion started by: tipsy
5 Replies
2. Shell Programming and Scripting
Hi All
I have written one shell script for GPRS route add is given below named GPRSRouteSet.sh
URL="www.google.com"
VBURL="10.5.2.211"
echo "Setting route for $URL for GPRS"
URL_Address=`nslookup $URL|grep Address:|grep -v "#"|awk -F " " '{print $2}'|head -1`
echo "Executing ... (3 Replies)
Discussion started by: mnmonu
3 Replies
3. Shell Programming and Scripting
Please help with this simple example. I can not figure out how to do it. A file named “job” contains only this one line:var=5I need a script to read the job file and execute it as a command. This is my attempt (it does not work):#!/bin/sh
exec < job
echo "var = $var"output should read “var = 5”... (5 Replies)
Discussion started by: wolfv
5 Replies
4. Linux
Hi Gurus ,
I hope you are doing great .
Other than owner of the file , OTHERS and GROUP should be restricted from read or write a file created by the owner.
OTHERS and GROUP should be only allowed to execute the file.
Thanks in advance. (8 Replies)
Discussion started by: palanisvr
8 Replies
5. Shell Programming and Scripting
Hello, I am quite new in shell scripting and I would like to write a little scritp to run a program on some parameters files.
all my parameters files are in the same directory, so pick them up with
ls *.para >>dirafter that I have a dir file like that:
param1.para
param2.para
etc...
I... (2 Replies)
Discussion started by: shadok
2 Replies
6. Shell Programming and Scripting
Hi
I am new to writing script and want to use a Bash Piped while-read and read from user input.
if something happens on server.log then do while loop or if something happend on user input then do while loop.
Pseudocode something like:
tail -n 3 -f server.log | while read serverline || read... (8 Replies)
Discussion started by: MyMorris
8 Replies
7. Shell Programming and Scripting
hello,
I have prepared a script
------------------------------------------------
#!/bin/sh
cat test.txt| sed '1d' | sed '$d' > /tmp/tmp1.txt
while read line
do
typeset -i count=`echo $line | tr ' ' '}' | wc -c`
finalcount=`expr $count - 1`
echo $finalcount
done <... (12 Replies)
Discussion started by: rac
12 Replies
8. Shell Programming and Scripting
Hi,
can some one help me how to encrypt and decrypt a file.
AIM: reade user input, encrypt it and save it to file.
while decryption read the encrypted file decrypt it and save the output in some variable.
Example: consider we have Credentials.txt file with content username: password... (5 Replies)
Discussion started by: saichand1985
5 Replies
9. Shell Programming and Scripting
Hi,
I am facing issues with the below:
I have a lookup file say lookup.lkp.This lookup.lkp file contains strings delimited by comma(,).
Now i want to read this command from file and execute it.
So my code below is :
Contents in the lookup.lkp file is :
c_e,m,a,`cd $BOX | ls cef_*|tail... (7 Replies)
Discussion started by: vital_parsley
7 Replies
10. Shell Programming and Scripting
I need to develop a process/daemon which will constantly monitor a file for new entry and execute a command.
for eg, there is a file /var/log/inotify.log
When a new entry like below gets appeneded to this file, execute the command as follows.
/home/user/public_html/bad.php|CREATE
... (2 Replies)
Discussion started by: anil510
2 Replies
LEARN ABOUT DEBIAN
pam-script
PAM-SCRIPT(7) Miscellaneous Information Manual PAM-SCRIPT(7)
NAME
pam-script - a PAM module that can invoke scripts within the PAM stack.
SYNOPSIS
pam-script.so [onerr=(success|fail)][dir=/some/path/]
DESCRIPTION
pam-script allows you to execute scripts during authorization, passwd changes, and on session opening or closing.
Such scripts can perform necessary tasks or influence the outcome of the PAM stack. For example, if the following entry was included in
pam.conf
sshd auth required pam_script
then if the script, pam_script_auth, exits with a non-zero value this would cause the user to be denied SSH access to the machine.
OPTIONS
A summary of options is included below.
onerr=(success|fail)
the default behavior if the module can not find or execute the script. The default is to fail if the option is not given.
dir=/some/path/
where to find the pam-scripts to invoke for each of the various module-types as described below. The default is dir=/usr/share/lib-
pam-script if not given.
List of scripts
pam_script_auth
Executed under auth which handles the authentication stage of establishing the user via some challenge-response (i.e. username/pass-
word)
pam_script_acct
invoked under account module-type for non-authentication based account management.
pam_script_passwd
invoked under passwd for changing the password tokens.
pam_script_ses_open
invoked when a session is first opened.
pam_script_ses_close
run after a session is first closed.
All the scripts will be passed several environment variables: PAM_USER, PAM_RUSER, PAM_RHOST, PAM_SERVICE, PAM_AUTHTOK, PAM_TTY, and
PAM_TYPE referring to the module-type. The pam_script.so arguments in the pam.conf will be passed on the command line, which can be
used to modify the script behavior.
FILES
/lib/security/pam_script.so - the PAM module
/usr/share/libpam-script - where the scripts should be placed by default
VERSION
pam-script 1.1.5
SEE ALSO
PAM(7) and the PAM "The System Administrators' Guide"
AUTHOR
pam-script was written by Jeroen Nijhof <jeroen@jeroennijhof.nl>
with some additions and modifications by R.K. Owen, Ph.D. <rkowen@nersc.gov>.
This manual page was written by R.K. Owen <rkowen@nersc.gov>,
for the Debian project (but may be used by others).
August 22, 2007 PAM-SCRIPT(7)