how to use sesu in shell script | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


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

how to use sesu in shell script

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 10-13-2011
rbalaj16 rbalaj16 is offline
Registered User
 
Join Date: Oct 2011
Last Activity: 11 April 2013, 11:40 AM EDT
Posts: 29
Thanks: 23
Thanked 0 Times in 0 Posts
Question how to use sesu in shell script

Hi,

I want to execute a set of commands in a server from a shell script after remotely login to that server using ssh and sesu to a some generic id.

my normal way to login to a server is

1. ssh user@server1
2. after that /usr/bin/sesu - genericid

i need help to execute this above two commands through shell script without entering password interactively.
i find the first one, ssh to a server, can be done through ssh-keygen. but i am not able to implement the second step in shell script.

Please suggest. THANKS.
Sponsored Links
    #2  
Old 10-13-2011
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 23 October 2014, 6:57 PM EDT
Location: Saskatchewan
Posts: 19,677
Thanks: 822
Thanked 3,351 Times in 3,138 Posts
What have you tried? In what way does it not work?

Perhaps:


Code:
ssh user@host /usr/bin/sesu - genericid < scriptfile

where scriptfile is a local file containing commands you wish to be run after logging in with sesu. It can't contain passwords.
Sponsored Links
    #3  
Old 10-14-2011
rbalaj16 rbalaj16 is offline
Registered User
 
Join Date: Oct 2011
Last Activity: 11 April 2013, 11:40 AM EDT
Posts: 29
Thanks: 23
Thanked 0 Times in 0 Posts
Question

Thanks corona for your response.

But my problem is unlike su, sesu expect password to be supplied. how to do this though script.

one more thing is, i cannot do any changes in sesu configuration or any root level as there is no root level access for me. i am here only as applicaiton admin.

Let me tell again how we have the login procedure here. i want the below 4 steps to be done thro script without typing password interactively.

ssh user@server
password: abc (need to be supplied)
./sesu - generic id
password: abc(again password to be supplied)


Please suggest. THANKS
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell script that runs a random shell script kylecn Shell Programming and Scripting 15 06-27-2011 10:40 PM
call another shell script and pass parameters to that shell script sunrexstar Shell Programming and Scripting 2 11-29-2010 02:53 PM
How to use ssh execute other shell script on other host (shell script include nohup)? orablue Shell Programming and Scripting 1 11-18-2010 08:46 PM
How to pass a parameter from one Shell-script to another Shell-script subodhbansal Shell Programming and Scripting 2 09-22-2007 05:19 AM
Have a shell script call another shell script and exit heprox Shell Programming and Scripting 2 11-20-2006 07:17 AM



All times are GMT -4. The time now is 03:45 AM.