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
switching user from root to ordinary user sasia Shell Programming and Scripting 3 01-25-2008 10:25 PM
How to hide user inputted text for interactive unix shell script? patrickpang Shell Programming and Scripting 1 04-04-2006 09:42 PM
SFTP- Non-interactive user authentication dheeruchakri Shell Programming and Scripting 1 03-10-2006 12:14 PM
switch user inside a script nimo Shell Programming and Scripting 2 11-04-2005 07:51 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

 
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 Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 11-19-2007
stevefox stevefox is offline
Registered User
  
 

Join Date: Aug 2005
Posts: 115
Non-interactive user switch to root

Is is possible switch user from a non-root user to root user without entering the password interactively inside a korn shell script which is run by a non-root user?

e.g. I have a non-root user called infodba who is in dba group and I want to create a shell script which is executed by infodba user and inside the script I want to switch to root user without getting prompted for the password and run chmod 777 command against a directory then switch back to infodba and create a file inside the directory. I like to perform the below in one script run by infodba without getting prompted for password.

(1) TEST_DIR exists with the access below
ls -ld TEST_DIR
drwxrwxr-x 2 root sys 80 Nov 20 10:45 TEST_DIR

(2) Give full access to TEST_DIR by root
chmod 777 TEST_DIR
ls -ld TEST_DIR
drwxrwxrwx 2 root sys 80 Nov 20 10:46 TEST_DIR

(3) Create a file inside TEST_DIR using infodba
touch TEST_DIR/test.txt

Cheers
Steve

Unix version : HP-UX 11.11
 

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 02:06 PM.


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