|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Script only runs as a particular user
Hi guys
So I've got this PERL script that for one reason or another I need to run as a user other than the user that created the script. When I su - to another user the script won't run and doesn't give me any output as to why. No permission denied or anything like that. I've chmod 777'd the script but still no joy. What am I missing? |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Hi Jay, If you want the script to run as the same user all the time, you should use the Set User ID bit - so no matter who runs the script it will run as the user that owns it. As for no output etc, you'll have to check the user environment. To set the SUID bit. Code:
chmod 4XXX /path_to_file Regards Dave |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Thanks for the reply Gull. I don't want it to run as the same user all of the time. In fact I need to make sure that it is NOT run as the user that created it (it's a long story).
Anyway can I use this chmod 4XXX /path_to_file to make the script executable by everyone? What am I replacing the X's with (talking to an utter noob here sorry! :P) |
|
#4
|
|||
|
|||
|
Hi Jay, To make the script executable by any one use the following; Code:
chmod 755 /path_to_script Things to be aware of here are the script may well be suppressing some of the output, although you should get at least a not found or a permission denied message. You'd have to have a look at yhe perl script to determine that. Users will have to either invoke the script with it's full path name or have their path amended to include the file directory. Regards Dave |
| The Following User Says Thank You to gull04 For This Useful Post: | ||
Jaymoney (08-02-2012) | ||
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Thanks again Gull but still no joy. Literally all that happens is this:
user1@server> ./script.pl running... running... running... Ctrl + c user1@server>su - user2 password: user2@server> ./script.pl user2@server> ---------- Post updated at 01:48 PM ---------- Previous update was at 01:35 PM ---------- Ok got it. It's the standard output being redirected like you said. The reason this is happening is because the script makes directories and user1 has permission to create said directories but user2 doesn't. Thanks Gull! |
| The Following User Says Thank You to Jaymoney For This Useful Post: | ||
alister (08-01-2012) | ||
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
Thank you for following up with your solution. It may prove helpful to someone else in the future.
Regards, Alister |
| The Following User Says Thank You to alister For This Useful Post: | ||
Jaymoney (08-02-2012) | ||
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need to run a bash script that logs on as a non-root user and runs script as root | damang111 | Shell Programming and Scripting | 2 | 12-23-2011 10:53 PM |
| Sunsolaris shell script runs only as super user | gjithin | Solaris | 4 | 05-09-2008 08:47 AM |
| Shell Script: want to insert values in database when update script runs | ring | Shell Programming and Scripting | 1 | 10-25-2007 03:06 AM |
| What user runs cron? | michieka | UNIX for Dummies Questions & Answers | 10 | 06-02-2002 10:32 PM |
|
|