Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: su in a script

Re: su in a script

From: Rick Wessman <Rick.Wessman_at_oracle.com>
Date: 25 Sep 2001 04:49:00 -0700
Message-ID: <socpu8ffq37.fsf@rwessman-sun.us.oracle.com>


"Daniel A. Morgan" <Daniel.Morgan_at_attws.com> writes:

> Robert Fazio wrote:
>
> > "ak" <a.kadivar_at_caramail.com> wrote in
> > news:9oaef9$8p9$1_at_norfair.nerim.net:
> >
> > > Hello
> > > Is it possible to use su command in a Shell script in order to change
> > > user
> > > ? If yes how give it the password without typing it on the keyboard?
> > > Thanks a lot.
> > >
> > >
> >
> > You are really in the wrong group, but the answer is yes and no. You can
> > use su in a script. But only if the user executing the script is root.
> >
> > su - username -c "some command" is a common syntax, but the only user that
> > can do this without a password is root.
> >
> > --
> > Robert Fazio
> > Senior Technical Advisor
> > dbabob_at_yahoo.com
>
> Is it possible to put the password into an environment variable and read it
> from there?
>
> Daniel A. Morgan
>

Unfortunately, no. If the user is not root, su requires the password to be read from the keyboard. Redirection ("su << END") is not allowed.

-- 
                                Rick Wessman
                                Security Assurance Group
                                Oracle Corporation
                                Rick.Wessman_at_oracle.com

     The opinions expressed above are mine and do not necessarily reflect
                         those of Oracle Corporation.
Received on Tue Sep 25 2001 - 06:49:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US