linux下如何实现外部认证
外部认证是指直接连到操作系统,在创建用户时候可以指定用户不通过口令。在linux下实现很容易,让我们来做个实验:
复制内容到剪贴板
代码:
[oracle@hundsun ~]$ id
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)
[oracle@hundsun ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Dec 16 15:45:18 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
sys@NIUGE> show parameter os;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
optimizer_index_cost_adj integer 100
os_authent_prefix string ops$
os_roles boolean FALSE
remote_os_authent boolean FALSE
remote_os_roles boolean FALSE
timed_os_statistics integer 0
sys@NIUGE> alter system set os_authent_prefix='' scope=spfile;
System altered.
sys@NIUGE> alter system set remote_os_authent=true scope=spfile;
System altered.
sys@NIUGE> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
sys@NIUGE> startup
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 79694068 bytes
Database Buffers 83886080 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
sys@NIUGE> create user oracle identified externally;
User created.
sys@NIUGE> grant connect to oracle;
Grant succeeded.
sys@NIUGE> select username,password from dbauser=upper('oracle');
select username,password from dbauser=upper('oracle')
*
ERROR at line 1:
ORA-00933: SQL command not properly ended
sys@NIUGE> select username ,password from dba_users where username=upper('oracle');
USERNAME PASSWORD
------------------------------ ------------------------------
ORACLE EXTERNAL
sys@NIUGE> show user;
USER is "SYS"
sys@NIUGE> connect /
Connected.
oracle@NIUGE> show user;
USER is "ORACLE"
oracle@NIUGE> select sysdate from dual;
SYSDATE
---------
16-DEC-07
oracle@NIUGE>