Shell Script execution issues


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell Script execution issues
# 1  
Old 02-26-2013
Shell Script execution issues

Hi,

There's a shell script by name "download", which has been created as user "mgr" and that script needs to executed as user "dev".

I tried giving privileges 701 on the script download.
But it's throwing the error message

Code:
bin]$ ./download
/bin/bash: ./download: Permission denied

But, when ever I tried it with 705, it works fine.
Since I have a password embedded in the script "download", I want to give execute only privileges to the other user.

Please let me know how can I achieve this.

Last edited by Scrutinizer; 02-26-2013 at 03:37 PM.. Reason: code tags
# 2  
Old 02-26-2013
Try just giving execute permission to every one like this and try:

chmod +x file
# 3  
Old 02-26-2013
The nature of a script is that it needs to be executable and readable (by the script interpreter).
Try to switch to another user that owns the script.
Like
Code:
sudo -u otheruser ./download

# 4  
Old 02-26-2013
@panyam:
I have already tried that, but wasn't helpful.

@madeInGermany:
When I tried sudo -u mgr ./download.sh, it's prompting to enter the password of the user "mgr". As I mentioned earlier, the mgr password can't be shared.

sudo -u mgr ./download
[sudo] password for mgr:

These are the current permissions I have on the script.

ls -ltr download
-rwx--x--x 1 mgr mgr 1970 Feb 26 13:42 download
# 5  
Old 02-27-2013
Try putting:
Code:
ALL ALL=(mgr) NOPASSWD: /path/to/download

in your /etc/sudoers files

--Edit--
You could then write a stub script (with 555 permissions) that runs sudo -u mgr /path/to/download
# 6  
Old 02-27-2013
@Chubler_XL: Thanks for the reply.
Are there any other ways than this to achieve my requirement.
# 7  
Old 02-27-2013
You could try compiling the script using shc:

https://www.unix.com/shell-programmin...g-scripts.html
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remote script over ssh execution issues.

If I execute below code I am able to get string from column8 and column10 about a process. serverA1$> ps -ef | grep rotate | grep 'config' | awk '{print $8" "$10}' /<Oracle_home>/ohs/bin/odl_rotatelogs -h:/<app_Home>/config/OHS/ohs1/component_events.xml_ohs1... (12 Replies)
Discussion started by: kchinnam
12 Replies

2. Solaris

Script on Solaris spawning 2 processes for one shell script execution

Hi, I am having a shell script on Solaris 10 which has a while loop as shown below. #!/usr/bin/ksh # while do sleep 60 done Name of the shell script is coldcentric.sh. I executed script /DATAWAREHOUSE/LOAD/Scripts/coldcentric.sh from a command task in Informatica worklow as... (3 Replies)
Discussion started by: chekusi
3 Replies

3. UNIX for Dummies Questions & Answers

shell script execution in ab initio

Hi All, How to execute shell script for running Ab initio graphs? Regards (0 Replies)
Discussion started by: eshalife
0 Replies

4. UNIX for Dummies Questions & Answers

Shell script execution methods

Hi, Shell script can be executed in few ways. I would like to know the differences in the below execution methods. sh file1.sh . file1.sh . /file1.sh Please help, thank you. (2 Replies)
Discussion started by: Dev_Dev
2 Replies

5. UNIX for Advanced & Expert Users

SSH using shell script terminates the script execution

Hello, I am writing a shell script in which i do ssh to remote server and count the number of files there and then exit. After the exit the shell script terminates which i believe is expected behavior. Can some one suggest me a way where even after the exit the script execution resumes. ... (2 Replies)
Discussion started by: manaankit
2 Replies

6. Shell Programming and Scripting

execution of aliases from shell script

Hi I have to execute the commands in .aliases file from a shell script I tried 1.giving the alias directly in shell script 2.Giving the actually "value of alias" in the shell script 3. I tried giving both steps 1 and 2 inside ` quotes Still nothing is working . It says command... (3 Replies)
Discussion started by: ssuresh1999
3 Replies

7. Shell Programming and Scripting

Cron execution of shell script

Hi Guys, Unable to run this script from the cron,although the same executes perfectly from the command line.Please help. #!/bin/sh #### aprintd alarm creation files ##### file=`date +%m%d%Y` pid=$$ echo "$pid" /u01/app/netboss/bin/aprintd/aprintd > $file & childpid=$!... (3 Replies)
Discussion started by: ashish.sharma
3 Replies

8. Shell Programming and Scripting

problem with shell script execution

Hi All, i am running a shell script in which there is a command `ps -ef | grep smon > db` When i execute this command in the command prompt i am getting the desired output..but when the script is executed..the db file is getting created but with no values...I could not find the reason for... (2 Replies)
Discussion started by: anju
2 Replies

9. UNIX for Dummies Questions & Answers

Sequential execution in shell script?

I've a shell script that invokes a URL of an application to do some work, e.g., http://www.abc.com/myservlet?action=helloworld.Does the shell wait for a return value from the URL call before proceeding to the next line of command? (6 Replies)
Discussion started by: chengwei
6 Replies

10. Shell Programming and Scripting

execution of shell script

How can I execute another shell script from one? Malay (5 Replies)
Discussion started by: malaymaru
5 Replies
Login or Register to Ask a Question