Top40-Charts.com
Support our efforts,
sign up for our $5 membership!
(Start for free)
Register or login with just your e-mail address
 Videos 

Changing user password using linux shell script.

How to change user password in Linux using shell scipt. Script has been shown with hard-coded as well as command line username and password. am providing you with the script code. #!/bin/bash ROOT_UID=0 E_WRONG_USER=65 E_NO_SUCH_USER=70 SUCCESS=0 if [ "$UID" -ne "$ROOT_UID" ] then echo "You need to be logged in as root to perform this operation" exit $E_WRONG_USER else echo "Continue with password change" fi username=$1 newpassword=$2 grep -q "$username" /etc/passwd if [ $? -ne $SUCCESS ] then echo "No such user exist" exit $E_NO_SUCH_USER fi echo "$newpassword" | passwd --stdin "$username" echo "Password for $username changed" exit 0
Top songs from around the world today


© 2001-2024
top40-charts.com (S6)
about | site map
contact | privacy
Page gen. in 0.2594931 secs // 59 () queries in 0.023862361907959 secs