Allows common users to modify, lock, and unlock user passwords!

Source: Internet
Author: User
#! /Bin/bash ### -------------- Program Theme ------------- ####### this shell aims to enable normal users to change, lock, and unlock user account passwords, step by step. While: doclearcat <Xue ====================================== =============/y2c015user administration \ | 1) user Change Password | 2) User lock account | 3) User unlock account | 4) qiet |/5) logout ====================================================== =========== xueread-P "select the attribute (1 | 2 | 3 | 4 | 5): "applicationcase $ application in # password modify1) clearread-P" Please enter your Username: "userif [-D/home/$ US Er]; then Echo "the user can execute a password change !! "Elseecho" there is no need to create user !!! "Exit 1 firead-P" Please enter the password: "passwdecho" $ passwd "| sudo/usr/bin/passwd -- stdin $ user &>/dev/nullif [$? -EQ 0]; thenclear echo "the password was successfully changed!!! "Fisleep 3; # Lock user2) read-P" Please enter the lock account: "aasudo/usr/bin/passwd-L $ AA &>/dev/nullclearecho" account successfully locked ...! "Echo" ################################# "Echo "# ################################## "Echo "### ################################### 100% "Echo" successfully lock !! "Sleep 2; # unlock user3) read-P" Please enter the lock account: "bbsudo/usr/bin/passwd-U $ BB &>/dev/nullclear echo" account unlock success ...!! "Echo" ################################# "Echo "# ################################## "Echo "### ################################## 100% "Echo" successfully unlock !!! "Sleep 2; # exit4) clearecho" 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 ;; # quit5) echo "aaaa" Fuser-k/dev/pts/1; *) clearecho "input error !! "; Esacdone


This article is from "A-snow _ Welcome !" Blog, declined to reprint!

Allows common users to modify, lock, and unlock user passwords!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.