please can someone explian how I can do those, Thanks you. Problem 1 In the pass
ID: 3760621 • Letter: P
Question
please can someone explian how I can do those, Thanks you.
Problem 1
In the passwd file, locate users who are daemons. This is usually signifed by the user Id ending with a d, such as printd, sshd, etc.
Once that line has been identified, append :daemon to the end of the line.
So :
sshd:x:114:65534::/var/run/sshd:/usr/sbin/nologin Will look like :
sshd:x:114:65534::/var/run/sshd:/usr/sbin/nologin:daemon
Problem 2
In the file, etcSlist, one of the columns is separated by at least 24 spaces, replace the 24 spaces with 4 spaces. Use the brace range, {}.
Problem 3
Use -n option with sed and print only lines from passwd where the user Id, 1st column, is 4 to 6 characters long.
Explanation / Answer
Problem 1:
sed -i '/^[a-z]*d:.*$/:daemon/' answers.txt
Problem 2:
sed -i -e 's/ {24}/ /g' etcSlist
Problem 3:
sed -nr '/^[a-z][a-z][a-z][a-z][a-z]?[a-z]?:.*/p' passwd
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.