|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Problem with feeding password while changing to root user
i want to change user to "root" from another user while running a script. how can i automatically feed the password? for example, i want to write a script say "script.sh"... it will first run the command "p" as mhmn user, and then it will change the user to "root" by using "su - root" command. at this point it asks for the password for root. say the password is "blue". i want to feed the p.w. automatically while it asks for it. inside script.sh it will look something like- Code:
#p #su - root (feed p.w. automatically here) #p Last edited by Scott; 01-16-2013 at 05:34 AM.. Reason: Code tags |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
That's not possible, except if the user is a member of the wheel group and PAM is configured to allow it.
Configuring sudo is probably the better way to go. Giving carte blanche access to root using su in this way is generally not a good idea. |
| The Following User Says Thank You to Scott For This Useful Post: | ||
mhmn (01-16-2013) | ||
| Sponsored Links | ||
|
![]() |
| Tags |
| change user, feed password automatically |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Permission denied when changing root password after reset | darkone_d1_2000 | UNIX for Dummies Questions & Answers | 0 | 06-25-2010 12:32 PM |
| changing user password as root on LDAP client SOl10/u7 | ilikecows | Solaris | 1 | 08-05-2009 09:18 AM |
| Problem changing user password | bbbngowc | Linux | 6 | 04-24-2009 01:28 PM |
| Changing root password | zetadhell | HP-UX | 3 | 05-14-2007 06:42 AM |
| changing user password | mayge | AIX | 0 | 07-12-2006 11:08 AM |
|
|