Hide Oracle Passwords: Useradd Passwd
Hide Oracle Passwords: Useradd Passwd
Hide Oracle Passwords: Useradd Passwd
You may be required to use passwords in scripts calling Oracle tools, like SQL*Plus,
Export/Import and RMAN etc. One method to remove the credentials from the
script itself is to create a credentials file to hold them. In this case I'm using
"/home/oracle/.scottcred", which contains the following.
scott/tiger
Change the permissions to make sure the file is only visible to the owner.
Now replace references to the credentials with the contents of the file.
OS Authentication
OS authentication allows Oracle to pass control of user authentication to the OS.
Non-priviliged OS authentication connections take the following form.
sqlplus /
sqlplus /@service
When a connection is attempted from the local database server, the OS username
is passed to the Oracle server. If the username is recognized, the Oracle the
connection is accepted, otherwise the connection is rejected.
First, create an OS user, in this case the user is called "tim_hall". In UNIX and
Linux environments this is done using the useradd and passwd commands.
# useradd tim_hall
# passwd tim_hall
New password:
# su - tim_hall
$ export ORACLE_HOME=/u01/app/oracle/product/10.1.0/db_1
$ export PATH=$PATH:$ORACLE_HOME/bin
$ export ORACLE_SID=DEV1
$ sqlplus /
ERROR:
The connections failed because we have not told Oracle the users are OS
authenticated. To do this, we must create an Oracle user, but first we must check
the value of the Oracle OS_AUTHENT_PREFIX initialization parameter.
SQL>
As you can see, the default value is "ops$". If this is not appropriate it can be
changed using the ALTER SYSTEM command, but for now we will use this default
value.
-- UNIX
su - tim_hall
export ORACLE_HOME=/u01/app/oracle/product/10.1.0/db_1
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=DEV1
sqlplus /
Connected to:
With the Partitioning, Oracle Label Security, OLAP and Data Mining options
SQL>
As you can see, the database servers in both environments are now configured to
allow the user "tim_hall" to connect using OS authentication.
If you prefer to have no prefix for the oracle user you need to set the
OS_AUTHENT_PREFIX parameter to null (empty string). The ALTER SYSTEM syntax
doesn't cope well with zero length strings, so you have to make the change the
long way.
shutdown immediate;
os_authent_prefix=''
sqlplus / as sysdba
os_authent_prefix string
SQL>