The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
su root from normal user karthikn7974 Shell Programming and Scripting 0 04-24-2008 10:16 PM
user commands without root access emealogistics HP-UX 1 05-27-2007 12:04 AM
switching between root and a normal user melanie_pfefer Shell Programming and Scripting 3 04-21-2007 08:02 AM
Capture of all commands issued by the user “root” elieifrah@gmail UNIX for Advanced & Expert Users 4 03-19-2007 10:55 AM
Other than root user .Normal user is unable to create files mallesh UNIX for Advanced & Expert Users 1 06-22-2005 01:18 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 4.00 average. Display Modes
  #1 (permalink)  
Old 01-16-2009
initin initin is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 3
Exclamation How a normal user run a script including root privileaged commands

Dear all
Ihave written a script in Hpux9.0, the ecript is working fine if I run it from root command prompt
But when I am running it thru /etc/profile or /user/.profile and login as a normal user, the owner of the process running the script is the normal user & hence cant run a root privileaged command
so pls help how can i run that script, so that a normal user when logs in the script should start in background with root privileages.
Thanks in advance
Nitin M
  #2 (permalink)  
Old 01-16-2009
Autocross.US's Avatar
Autocross.US Autocross.US is offline
Registered User
  
 

Join Date: Nov 2008
Location: Chesapeake, VA
Posts: 73
I just answered this on ITRC, so here's the pasted text:

This can be done with sudo.

Run this command to edit the sudoers file:
visudo

Add something like this (for 'user1' as example):
user1 ALL = NOPASSWD: /path/to/script.sh

Then in the user1 .profile, add this:
sudo /path/to/script.sh &

This will run the command as root in the background. For more information on sudo:

Sudo Main Page
  #3 (permalink)  
Old 01-16-2009
initin initin is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 3
Thanks dear ,
But I am using HPux 9.0 & I dont have the sudo installed & not available on for download also.
  #4 (permalink)  
Old 01-16-2009
Autocross.US's Avatar
Autocross.US Autocross.US is offline
Registered User
  
 

Join Date: Nov 2008
Location: Chesapeake, VA
Posts: 73
You should be able to compile sudo from source on HP-UX 9.0. Check the download section on the sudo home page.
  #5 (permalink)  
Old 01-16-2009
pludi's Avatar
pludi pludi is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2008
Location: .at
Posts: 1,972
Sudo download with prepared binaries. (no 9.x though)
  #6 (permalink)  
Old 01-16-2009
JerryHone JerryHone is offline
Registered User
  
 

Join Date: Nov 2006
Location: UK
Posts: 178
Get your system administrator to change the ownership of the file to root and then change the file permissions to add the set user-ID bit.


Code:
chown root filename
chmod u+s filename

When you 'ls' the file you'll see an output such as:


Code:
-rwsrwxrw- root    root    filename

I believe that if you then edit the script, you'll lose the s bit, as otherwise there a huge security loophole!

Hope that helps.

Jerry
  #7 (permalink)  
Old 01-16-2009
methyl methyl is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 1,184
The safe response is to create a root cron which polls for a user-generated
flag file. On finding the flag file the root cron executes the desired script
and then removes the flag file.

We cannot endorse upgrading the privilege of shell scripts with SUID
techniques in this context.

We are slightly concerned about the motives of this post.

Sudo is irrelevant on HPUX 9.0, but remains a useful tool in modern OS.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:02 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0