| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #!/bin/bash
- # info: change user password
- # options: user password
- #
- # The function changes user's password and updates RKEY value.
- #----------------------------------------------------------#
- # Variable&Function #
- #----------------------------------------------------------#
- # Argument defenition
- user=$1
- password=$2
- # Importing variables
- source $VESTA/conf/vars.conf
- source $V_CONF/vesta.conf
- source $V_FUNC/shared.func
- #----------------------------------------------------------#
- # Verifications #
- #----------------------------------------------------------#
- # Checking arg number
- check_args '2' "$#" 'user password'
- # Checking argument format
- format_validation 'user' 'password'
- # Checking user
- is_user_valid
- # Checking user is active
- is_user_suspended
- #----------------------------------------------------------#
- # Action #
- #----------------------------------------------------------#
- # Changing user password
- echo "$password" | /usr/bin/passwd "$user" --stdin >/dev/null 2>&1
- #----------------------------------------------------------#
- # Vesta #
- #----------------------------------------------------------#
- # Changing RKEY value
- update_user_value "$user" '$RKEY' "$(gen_password)"
- # Hiding password
- V_EVENT="$V_DATE $V_SCRIPT $user *****"
- # Logging
- log_event 'system' "$V_EVENT"
- exit
|