Showing posts with label whoami. Show all posts
Showing posts with label whoami. Show all posts

Wednesday, January 04, 2012

os_authent_prefix

In Oracle 10, the default value for os_authent_prefix was ops$:
 
SQL> l
  1  select value, isdefault
  2  from v$parameter
  3* where name = 'os_authent_prefix'
SQL> /
 
VALUE      ISDEFAULT
---------- ---------
ops$       TRUE
 
SQL>
 
So, if you created an ops$oracle user with a password:
 
SQL> grant dba to ops$oracle
  2  identified by andrew
  3  /
 
Grant succeeded.
 
SQL>
 
And you were logged onto the server hosting your database as UNIX user oracle:
 
TEST10 > whoami
oracle
TEST10 >
 
... you could logon to the database externally:
 
TEST10 > sqlplus /
 
SQL*Plus: Release 10.2.0.3.0 - Production on Tue Jan 3 14:41:28 2012
 
Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.
 
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
 
SQL>
 
... or by using the password, which may not have been what you intended:
 
SQL> conn ops$oracle/andrew
Connected.
SQL>
 
To stop this happening, you could add the following line to your database’s parameter file:
 
os_authent_prefix = ""

Friday, April 29, 2011

SQL*Plus on UNIX and ps -ef

This example was tested on an Oracle 10 database running on Solaris.

Imagine you have a UNIX user called smithj. He logs into the system database user as follows:

TEST10 > whoami
smithj
TEST10 > sqlplus system/secret

SQL*Plus: Release 10.2.0.3.0 - Production on Tue Apr 26 15:13:23 2011

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

SQL>

However, while he is doing this, another user, e.g. bloggsf, can use the ps command to see the password for the system database user as follows:

TEST10 > whoami
bloggsf
TEST10 > ps -ef|grep sqlplus|grep -v grep
smithj 4324 29829 0 15:13:23 pts/12 0:00 sqlplus system/secret
TEST10 >

To stop this happening, smithj should login to the database with the username and wait for Oracle to prompt him for the password:

TEST10 > sqlplus system

SQL*Plus: Release 10.2.0.3.0 - Production on Tue Apr 26 16:12:37 2011

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

Enter password:

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

SQL>

Then bloggsf can see that smithj has logged in to the system user but cannot see the password:

TEST10 > ps -ef|grep sqlplus|grep -v grep
smithj 21306 20953 0 16:12:37 pts/12 0:00 sqlplus system
TEST10 >