Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Oracle Database 12c Security Cookbook

You're reading from  Oracle Database 12c Security Cookbook

Product type Book
Published in Jun 2016
Publisher Packt
ISBN-13 9781782172123
Pages 388 pages
Edition 1st Edition
Languages
Authors (2):
Zoran Pavlovic Zoran Pavlovic
Profile icon Zoran Pavlovic
Maja Veselica Maja Veselica
Profile icon Maja Veselica
View More author details

Table of Contents (18) Chapters

Oracle Database 12c Security Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
1. Basic Database Security 2. Security Considerations in Multitenant Environment 3. PL/SQL Security 4. Virtual Private Database 5. Data Redaction 6. Transparent Sensitive Data Protection 7. Privilege Analysis 8. Transparent Data Encryption 9. Database Vault 10. Unified Auditing 11. Additional Topics 12. Appendix – Application Contexts

Creating and using OS-authenticated users


In this recipe, you'll learn about OS-authenticated users.

Getting ready

To complete this recipe, you'll need an existing user who has a dba role, for example, johndba. It is assumed that you are working on Linux.

How to do it...

  1. Connect to the database as a user who has a DBA role:

    $ sqlplus johndba
    
    
  2. Find the prefix for operating system authentication:

    SQL> show parameter os_authent_prefix
       
    NAME                  TYPE          VALUE      
    -----------------     --------      -----------
    os_authent_prefix     string        ops$
    
  3. Create an OS-authenticated user:

    SQL> create user ops$zoran identified externally;
    
    
  4. Grant this user the create session privilege:

    SQL> grant create session to ops$zoran;
    
    
  5. Log in to the operating system as the user zoran:

    $ su - zoran
    
    
  6. Connect to the database without entering a user name or password:

    $ sqlplus /
    
    

How it works...

In OS authentication, database delegates user authentication to the operating system. This means that in order for OS authentication to work, user must exist as the user of the operating system. In database, these users are created with a prefix that is defined in the os_authent_prefix parameter (default is ops$). If an OS-authenticated user has the create session privilege, he or she can connect to the database using the following syntax:

    SQL> connect /
    Connected.
    
    SQL> show user
    USER is "OPS$ZORAN"

Note

Note that you cannot grant a sysdba,  sysoper,  sysbackup,  sysdg, or  syskm privilege to users that are identified externally, using a  grant statement:

 SQL> grant sysdba to ops$zoran;
    grant sysdba to ops$zoran

ERROR at line 1: ORA-01997: GRANT failed: user
      'OPS$ZORAN' identified externally

If you want to connect as sysdba using OS authentication, you have to add OS user zoran to OS group DBA:

[root@db121 ~]# usermod -a -G dba zoran
[root@db121 ~]# su - zoran
[zoran@db121 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Fri Sep 03 20:14:03 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64 bit
Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

There's more...

You can change the os_authent_prefix parameter with custom value (or you can leave it blank if you want OS-authenticated database users to have the same name as OS users).

You have been reading a chapter from
Oracle Database 12c Security Cookbook
Published in: Jun 2016 Publisher: Packt ISBN-13: 9781782172123
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}