Câu 6: EX300: Red Hat Certified Engineer (RHCE)
Create a script to add users -Create a script named /root/mkusers on the system1, this script can achieve to add local users for the system1, and user names of these users are all from a file which contains the usernames list, and meet the following requirements at the same time:1. This script is required to provide a…
Nội dung câu hỏi
Create a script to add users -Create a script named /root/mkusers on the system1, this script can achieve to add local users for the system1, and user names of these users are all from a file which contains the usernames list, and meet the following requirements at the same time:1. This script is required to provide a parameter; this parameter is the file which contains the usernames list2. This script need provide the following message: Usage /root/mkusers if it does not provide a parameter, then exit and return the corresponding value3. This script need provide the following message: Input file not found if it provides a name that does not exist, then exit and return the corresponding value4. Create a user shell log into /bin/false5. This script does not need to set password for users6. You can get the usernames list from the following URL as a test: http://rhgls. domain11.example.com/materials/ userlist
Các lựa chọn
Đáp án được giữ gọn theo nhãn A, B, C, D trong phần bình chọn tương tác.
- A. vim mkusers.sh#! /bin/bashif [ $# -eq 0 ];thenecho 'Usage:/root/mkusers'exit 1fiif [ ! -f $1 ]; thenecho 'Input file not found'exitfiwhile read linedouseradd -s /bin/false $linedone < $1:wqchmod +x mkusers.shhttp://rhgls.domain11.example.com/materials/userlistwget./mkusers.sh userlist — đáp án hiện tại
Cộng đồng
0 bình luận công khai. Tên thành viên được ẩn một phần.