In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Notes and instructions for the use of Solaris_change_passwd
1.
The script only tests the English and Chinese versions of Solaris10 (produced by oracle)
two。
The Solaris10 Chinese version system needs to change the system character set to zh_CN.UTF-8
3.
Execute this script as bash
Bash Solaris_change_passwd user name ($1) IP address ($2) user password ($3) user name that needs to be changed ($4) changed user password ($5)
Script variable definition:
#! / bin/bash
USER=$1 # user name
IP=$2 # IP address
PW=$3 # user password
CHE_USER=$4 # username that needs to change the password
CHE_PW=$5 # changed password
Ping-c 3 ${IP} > / dev/null # ping 3 times $IP address does not output display
If ["$?"-ge "1"]; then # if the output is greater than or equal to 1, then
Echo "The network impassability" # output "The network impassability"
Exit 1 # exits this cycle
Fi # ends the if loop
Expect-c "# call expect script
Set timeout 30 # sets the timeout to 30 seconds
Match_max 100000 # sets the maximum matching length to 100000
Spawn ssh $USER@$IP # call the ssh program to log in
Expect {
\ "yes\ / no\" {send\ "yes\ n\"; when exp_continue} # matches yes/no, enter yes. Continue to execute downward
\ "assword:\" {# matches to "assword"
Send\ "${PW}\ n\" # enter $PW
When expect\ "Permission denied\" {# matches "Permission denied"
Send_user\ "\ nUser name password mistake, or no permissions.\ n\"
# output "nUser name password mistake, or no permissions."
Exit 2 # exit 2 Loop
}
}
\ "password:\" {# matches "assword"
Send\ "${PW}\ n\" # enter $PW
When expect\ "Permission denied\" {# matches "Permission denied"
Send_user\ "\ nUser name password mistake, or no permissions.\ n\"
# output "nUser name password mistake, or no permissions."
Exit 3 # exit 3 Loop
}
}
\ "Connection refused\" {# matches to "Connection refused"
Send_user\ "\ nSSH Service is not open\ n\" # output "nSSH Service is not open"
Exit 4 # exit 4 Loop
}
}
Expect\ "* # *\" {send\ "passwd $CHE_USER\ n\"} # when matching to #, enter "passwd $CHE_USER"
Expect {
\ "assword:\" {send\ "$CHE_PW\ n\"; exp_continue} # when matching to assword, enter $CHE_PW to continue execution
\ "password:\" {send\ "$CHE_PW\ n\"; exp_continue} # matches password: enter $CHE_PW to continue execution
}
Expect\ "#\" {send\ "exit\ n\"} # enter exit to exit (kill if you can't)
Expect eof # end expect invocation script
"
Usage: bash gaimi.sh root 192.168.0.2 redhat aa 123123
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.