-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathchange_password.sh
More file actions
34 lines (28 loc) · 782 Bytes
/
change_password.sh
File metadata and controls
34 lines (28 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# change_password.sh - changes a user's Oracle password in the prod database
#
# written by Dennis Heltzel
usage() {
echo "Usage: $0 <Username>"
exit 1
}
if [ $# -lt 1 ]; then
usage
exit 1
fi
PASSWORD_SIZE=20
. ~/bin/ora_funcs.sh
oe FTSPRD
USER=$1
# 2 options for easily generating a random password
NEWPASS=`openssl rand -base64 ${PASSWORD_SIZE}`
#NEWPASS=`date|md5sum|cut -c-${PASSWORD_SIZE}`
sqlplus -s / as sysdba <<!
alter user $USER identified by "$NEWPASS" account unlock;
prompt Your new password is $NEWPASS
prompt You can change your password anytime with:
prompt alter user $USER identified by "<new password>" replace "$NEWPASS";
prompt Your password will expire in 60 days, please change it before then.
prompt connect $USER/"$NEWPASS"
exit
!