首页 > 代码库 > 实现普通用户修改用户密码、锁定、解锁!
实现普通用户修改用户密码、锁定、解锁!
#!/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_欢迎您!” 博客,谢绝转载!
实现普通用户修改用户密码、锁定、解锁!
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。