除了第三方工具以外,oracle提供的修改用户的密码有2种方式:
1.alter user test1 identified by test1;
2.password test1
那么这两种有什么区别?哪一种更加安全?
1.测试的脚本:
# cat -v Tcpdumpsql
#! /bin/bash
/usr/sbin/tcpdump -l -i eth0 -s 16384 -A -nn src host $1 and dst port 1521 2>/dev/null | tee -a /tmp/aa1 |sed -u -e "s/^M/!/g;s/^E\.\..\{1,100\}//;s/\.*$//;s/^\.*//" | \
awk '{if (tolower($0) ~ "select" || tolower($0) ~ "update" || tolower($0) ~ "delete" ||tolower($0) ~ "alter" || tolower($0) ~ "insert" || $0 ~ "ORA-" ) {p=1;print} \
else if(p == 1 && $0 !~ "^[0-9][0-9]:") {print} else if ($0 ~ "^[0-9][0-9]:") {p=0}}'
--//注:^M 实际上在vi里面要通过ctrl+v ctrl+m输入(windows下ctrl+q ctrl+m)
tcpdump是一个抓包工具,具体用法参考:
https://www.cnblogs.com/howhy/p/6396664.html
此脚本可以根据自己环境的不同进行更改,比如网卡名称,以及端口等参数。
2.测试alter user 命令:
服务器端打开脚本,等待客户端执行命令
[root@qht131 oracle]# ./Tcpdumpsql 172.17.61.181
sqlplus客户端:
SQL> select sysdate from dual;
SYSDATE
--------------
07-4? -20
SQL> alter user test1 identified by test1;
用户已更改。
查看服务器端的输出:
[root@qht131 oracle]# ./Tcpdumpsql 172.17.61.181
select sysdate from dual
$alter user test1 identified by test1
从输出发现修改的密码以明文的方式显示出来了。
3.测试password方式修改密码
服务器端打开脚本,等待客户端执行命令
[root@qht131 oracle]# ./Tcpdumpsql 172.17.61.181
sqlplus客户端:
SQL> select sysdate from dual;
SYSDATE
--------------
07-4? -20
SQL> password test1
更改 test1 的口令
新口令:
重新键入新口令:
口令已更改
查看服务器端的输出:
[root@qht131 oracle]# ./Tcpdumpsql 172.17.61.181
select sysdate from dual
PASSWORD@...@9EB97E6321772852AE84EAD9F3FC215CD73A1FD2E7D0AB56B73FAFB196247CEE....!...!AUTH_TERMINAL.....QHT81.........AUTH_PROGRAM_NM.....sqlplus.exe.........AUTH_MACHINE!...!L5M-DIT\QHT81.........AUTH_PID ... 4568:5316.........AUTH_SID.....lu.........AUTH_ALTER_SESSION.....@ALTER SESSION SET NLS_LANGUAGE= 'SIMPLIFIED CHINESE' NLS_TERRITO@RY= 'CHINA' NLS_CURRENCY= '.' NLS_ISO_CURRENCY= 'CHINA' NLS_NUME@RIC_CHARACTERS= '.,' NLS_CALENDAR= 'GREGORIAN' NLS_DATE_FORMAT= @'DD-MON-RR' NLS_DATE_LANGUAGE= 'SIMPLIFIED CHINESE' NLS_SORT= 'B@INARY' TIME_ZONE= '+08:00' NLS_COMP= 'BINARY' NLS_DUAL_CURRENCY=@ '.' NLS_TIME_FORMAT= 'HH.MI.SSXFF AM' NLS_TIMESTAMP_FORMAT= 'DD@-MON-RR HH.MI.SSXFF AM' NLS_TIME_TZ_FORMAT= 'HH.MI.SSXFF AM TZR'9 NLS_TIMESTAMP_TZ_FORMAT= 'DD-MON-RR HH.MI.SSXFF AM TZR'
输出的密码进行了加密处理!
从这里看出,改变口令使用password更加安全一些.