|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Sudo -s without password prompt
hi,
i have a requirement where i need to sudo to another user in the shell script.suppose consider user A and B, first user A calls a shell script and then i need to sudo to user B which executes another shell script inside the earlier one. also this needs to be automated like while sudo'ing to user B it should not ask for password prompt, password should be read from some file or by any other means.i'm a newbiew , please sugggest steps for the above problem. other than this is there any way around for my problem??? please suggest ??? |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Hi Krk
To do a sudo you should have an entry on the sudoers file that allows you to do the task needed to be done as other user or root. Better than trying to go deeper into your specific situation i guess it would be better for you to learn how to use sudo, here is a kind of "how to" for sudo I found on the web: 7 Linux sudo Command Tips and Tricks Hope it helps you Regards. |
| The Following User Says Thank You to Ikaro0 For This Useful Post: | ||
krk (01-04-2013) | ||
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
There's no silver bullet for your problem. If compliant to your site's policy, you could disable the authentication requirement (cf. man sudoers):
Quote:
Quote:
|
| The Following User Says Thank You to RudiC For This Useful Post: | ||
krk (01-04-2013) | ||
|
#4
|
||||
|
||||
|
Your shell script (as called by user A) would have this line in it: Code:
sudo -u userb /full/path/to/anotherShellScript.sh The "-u userb" flag tells sudo to run as the supplied user instead of root Add the following line to your sudoers config file: Code:
usera ALL=(userb) NOPASSWD: /full/path/to/anotherShellScript.sh The "usera ALL" tells sudo that usera on any server (ALL) my run this command The "(userb)" tells sudo that the command can only be run as userb (not the default of root) The "NOPASSWD:" tells sudo not to prompt for usera's password like it normally would (unless otherwise configured elsewhere) Some traps to watch for:
Last edited by Smiling Dragon; 01-04-2013 at 09:09 PM.. |
| Sponsored Links | ||
|
![]() |
| Tags |
| sudo -s |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ssh foo.com sudo command - Prompts for sudo password as visible text. Help? | fluoborate | Shell Programming and Scripting | 9 | 11-02-2011 02:18 PM |
| sudo - prompt for comment/text | th1amigo | Shell Programming and Scripting | 4 | 05-04-2010 01:59 PM |
| Bash script prompt for sudo password? | PatGmac | OS X (Apple) | 2 | 05-01-2009 04:05 PM |
| sudo, use in script without prompt for password | gauravgrover50 | Shell Programming and Scripting | 4 | 04-25-2009 08:26 AM |
| sudo in OS X shell script without password prompt?? | Brad_GNET | UNIX for Dummies Questions & Answers | 1 | 07-29-2005 06:36 PM |
|
|