March 2002
Beginner
504 pages
10h 47m
English
| 1: | Add a check to the sshd init script that verifies if the user is root. (Init scripts should only be executed by root). HINT: Use the id and sed commands. |
| A1: | You can add a check similar to the following to the beginning of the init script:
CURUID="`id | sed -e 's/(.*$//' -e 's/^.*\=//'`"
if [ "$CURUID" -ne 0 ] ; then
echo "Error: Only root (uid=0) can run this script." 1>&2
exit 1
fi
unset CURUID
|
| 2: | The showperson script lists all matching entries in the address book based on a name provided by the user. The matches produced are case sensitive. How can you change the script matches so they aren't case sensitive? |
| A2: | Use grep -i instead of grep. |
| 3: | Both the showperson and delperson scripts reproduce the following codePATH=/bin:/usr/bin ... |
Read now
Unlock full access