- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: run a script by some other user
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2007 06:44 PM
06-25-2007 06:44 PM
I have a script owned by xyz and i would like to run it from hash prompt by the user root.
how do i do this ,the current state of the script is ;
-rwsr-xr-x 1 xyz sr 177 Jun 22 10:14 gchk.sh
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2007 06:49 PM
06-25-2007 06:49 PM
Re: run a script by some other user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2007 07:04 PM
06-25-2007 07:04 PM
Re: run a script by some other user
I would like to run that script in background.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2007 07:05 PM
06-25-2007 07:05 PM
Re: run a script by some other user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2007 07:09 PM
06-25-2007 07:09 PM
Re: run a script by some other user
su to xyz and simply issue
$ echo /path/to/gchk.sh | batch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2007 07:10 PM
06-25-2007 07:10 PM
Re: run a script by some other user
Actually everyday all the processes owned by that user gets killed, so i need to run that script as root user...in backgriuond so that once its run it never gets killed..by using nohup
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2007 07:14 PM
06-25-2007 07:14 PM
Re: run a script by some other user
Then besides setting the user sbit (chmod u+s ...) you need to chown root the file.
But be careful, generally one should avoid suid executables.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2007 07:14 PM
06-25-2007 07:14 PM
Re: run a script by some other user
Then you need to make a copy of that script and remove the SUID bit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2007 07:18 PM
06-25-2007 07:18 PM
Re: run a script by some other user
But changing th ownership of the file from xyz to root,the script wont be executed as owner xyz...right
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2007 07:21 PM
06-25-2007 07:21 PM
Re: run a script by some other user
Then you need to make a copy of that script and remove the SUID bit.
I wnat to run a script as user/owner of that script " xyz " but the script should be executed by root user..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2007 07:36 PM
06-25-2007 07:36 PM
Re: run a script by some other user
You can't be both at the same time. The script has SUID so no matter who runs it, the user is the script owner.
Looking at ps, I see the script owner in the UID field.
To put in the background, just add "&".
>Ralph: generally one should avoid suid executables.
On 11.23, the default is to disallow them:
secure_sid_scripts 1 1 Immed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2007 07:46 PM
06-25-2007 07:46 PM
Re: run a script by some other user
When i run the script as root user and then when i do ps -ef|grep ch i get;
root 431 14492 4 13:12:38 pts/24 0:00 sh ./chk.sh
And uid is root and not my "xyz " user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2007 07:47 PM
06-25-2007 07:47 PM
Re: run a script by some other user
When i run the script in background as root user and then when i do ps -ef|grep ch i get;
root 431 14492 4 13:12:38 pts/24 0:00 sh ./chk.sh
And uid is root and not my "xyz " user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2007 09:01 PM
06-25-2007 09:01 PM
Re: run a script by some other user
Script to run in background:
-rwsr-xr-x 1 xyz sr 177 Jun 22 10:14 gchk.sh
FROM ROOT PROMPT BY ROOT USER ONLY WITH NOHUP option.
Regards,
Boomer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2007 09:02 PM
06-25-2007 09:02 PM
Re: run a script by some other user
Script to run in background:
-rwsr-xr-x 1 xyz sr 177 Jun 22 10:14 gchk.sh
FROM ROOT PROMPT BY ROOT USER,BUT MUST SHOW USER -ID AS " xyz " ( in ps -ef|grep gchk ) ONLY WITH NOHUP option.
Regards,
Boomer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2007 09:59 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2007 10:03 PM
06-25-2007 10:03 PM
Re: run a script by some other user
I too have hpux 11i v2 i.e. 11.23 O.s.
but as i have mentioned my problem.in the previous post,please suggest me any further solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2007 11:03 PM
06-25-2007 11:03 PM
Re: run a script by some other user
No matter what I did, the UID listed in ps was root.
The documentation says that ps returns the real user ID in UID. So perhaps everything is working after all?
Hmm, it seems that ps works differently. If you use -ef and grep you see the effective ID.
But if you use -fu, you get the real ID.
Ah, if you use UNIX95=, you get the effective ID. And that's what's documented!
+ The -u option will select users based on effective UID rather than real UID.
So this may be how you can stop it from being killed.