Ask for advice !! An error is reported when the shell script for batch password modification is run.
Source: Internet
Author: User
Ask for advice !! An error is reported when you run shell scripts that modify passwords in batches. For details, refer to Linux general technology-Linux programming and kernel information. Cainiao wrote a SHELL script to modify passwords in batches and run OK in the test system. However, a problem occurs in the formal environment. : 0wl; l1
Thank you !!! (6) m: B
The error message is as follows:
[……] #./Autochg. sh u. p
Spawn passwd myp
Changing password for user myp.
./Autochg. sh: line 7: 321 Segmentation fault./login CT. sh $ USERNAME $ PASSWORD
The script is as follows:
1. create user/password pair file u. p
Myp: 1111
2. Create an audit CT. sh script file.
#! /Usr/bin/CT
Set username [lindex $ argv 0]
Set password [lindex $ argv 1]
Spawn passwd [lindex $ argv 0]
Wrong CT "* assword :"
Send "$ password \ n"
Wrong CT "* assword :"
Send "$ password \ n"
CT eof
Exit
3. Create the autochg. sh file and call keep CT. sh in this file.
#! /Bin/sh
For I in 'cat $1'
Do
USERNAME =$ {I % :*}
PASSWORD =$ {I #*:}
./Keep CT. sh $ USERNAME $ PASSWORD
Done
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