#!/bin/bash ###--------------Program theme-------------###### # #本Shell,是为了实现普通用户可以修改用户账户密码更改、锁定、解锁,制定的脚步。 while : do clear cat <<xue =============================================== / Y2c015 user administration \| 1) user change password | | 2) user lock account | | 3) user unlock account | | 4) qiet | / 5) logout \================================================ xue read -p "Select the attribute (1|2|3|4|5) : " Application case $Application in #password Modify 1) clear read -p "Please enter your username :" user if [ -d /home/$user ] ; then echo "The user can execute a password change!!" else echo "There is no need to create user!!!" exit 1 fi read -p "Please enter the password :" passwd echo "$passwd" |sudo /usr/bin/passwd --stdin $user &>/dev/null if [ $? -eq 0 ] ;then clear echo " The password was successfully changed ! ! !" fi sleep 3 ;; #lock user 2) read -p "Please enter the lock account:" aa sudo /usr/bin/passwd -l $aa &>/dev/null clear echo "Account successfully locked...!" echo "#################################" echo "###################################" echo "##################################### 100%" echo "successfully lock!!" sleep 2 ;; #Unlock user 3) read -p "Please enter the lock account: " bb sudo /usr/bin/passwd -u $bb &>/dev/null clear echo "Account unlock success...!!" echo "#################################" echo "###################################" echo "##################################### 100%" echo "successfully Unlock!!!" sleep 2 ;; # exit 4) clear echo "Good bye, welcome to use" echo -n "[" for i in {1..3} ; do echo -n "####################" [ $i -eq 3 ] && echo -n "]" && echo && exit 0 sleep 1 done ;; # quit 5) echo "aaaa" fuser -k /dev/pts/1 ;; *) clear echo "Input error!!" ;; esac done
本文出自 “a-Snow_欢迎您!” 博客,谢绝转载!
原文地址:http://snlinux.blog.51cto.com/9114162/1549225