The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
scp automated script gholdbhurg UNIX for Advanced & Expert Users 5 10-27-2008 01:23 AM
Automated SFTP script aggar_y Shell Programming and Scripting 6 08-05-2008 02:39 PM
automated sftp script klindel Shell Programming and Scripting 2 05-13-2008 01:45 AM
Need automated shell script please uneex Shell Programming and Scripting 2 05-02-2008 08:36 AM
Need help for automated shell script uneex Shell Programming and Scripting 4 05-01-2008 12:15 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-22-2006
splax splax is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 5
Angry help for automated script

Hi ALL:
I need to write a script that will start bunch of servers. and these servers each has a sudo account and they need a passowrd.

I dont know where to start and look.

Can you please give me some hints or some sample code.

Thanks in advance.

splax
  #2 (permalink)  
Old 12-22-2006
splax splax is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 5
I am trying the basic thing first. Try to sudo with password and it is not working.
I have the passowrd stored in file "passwordfile" and my script:

Code:
#!/bin/sh
cat passwordfile | sudo -S su - myapp
But it is not working. any ideas.?

Last edited by splax; 12-22-2006 at 02:28 PM..
  #3 (permalink)  
Old 12-23-2006
sumitpandya sumitpandya is offline
Registered User
  
 

Join Date: Mar 2006
Location: Ahmedabad
Posts: 125
Almost all the program read password from "terminal" only. So better you run that script with root login or do setuid bit for those binary of daemon/server/program (risky)
  #4 (permalink)  
Old 12-26-2006
splax splax is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 5
even though the script is not reading the password from file, which is good, it is prompting for a password. So we got rid of that file (needs to enter the password).

Now, the remaining tasks are after sudo and loging with password, I need to run some commands in the sudo environment and after successful completion of these commands I have to logout and do sudo to a different account and then do the same.

Is there a way to run some commands in this sudo environment and capture the output check the status of these commands.??

please help.
  #5 (permalink)  
Old 12-26-2006
kapilraj kapilraj is offline
Registered User
  
 

Join Date: Dec 2006
Location: Maryland
Posts: 162
password are read *only and ONLY from terminal for better security. There are some third party utilities like "accept" , using which you can play around. I never tried this one , but you are free to search for this in the net.

Regds,

Kaps
Sponsored Links
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 08:51 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