- Oracle Database 12c Security Cookbook
- Zoran Pavlovi? Maja Veselica
- 375字
- 2021-07-02 16:43:13
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...
- Connect to the database as a user who has a DBA role:
$ sqlplus johndba
- Find the prefix for operating system authentication:
SQL> show parameter os_authent_prefix NAME TYPE VALUE ----------------- -------- ----------- os_authent_prefix string ops$
- Create an OS-authenticated user:
SQL> create user ops$zoran identified externally;
- Grant this user the
create session
privilege:SQL> grant create session to ops$zoran;
- Log in to the operating system as the user
zoran
:$ su - zoran
- 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"
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).
- Learn Blockchain Programming with JavaScript
- GeoServer Cookbook
- 深入理解Django:框架內幕與實現原理
- R語言數據可視化之美:專業圖表繪制指南
- 神經網絡編程實戰:Java語言實現(原書第2版)
- oreilly精品圖書:軟件開發者路線圖叢書(共8冊)
- Android 7編程入門經典:使用Android Studio 2(第4版)
- JavaScript從入門到精通(第3版)
- Python Network Programming Cookbook(Second Edition)
- TypeScript實戰指南
- 用Flutter極速構建原生應用
- Corona SDK Mobile Game Development:Beginner's Guide(Second Edition)
- Visual Basic程序設計上機實驗教程
- C++從入門到精通(第5版)
- Terraform:多云、混合云環境下實現基礎設施即代碼(第2版)