I'm studying for LPI, and got to solve this question:
Find out which file contains the following entry:
So far I've tried out using two solutions to list the required files out of the whole system (/):
grep -H -I -i -n -R 'root:x:0:0:root:/root:/bin/bash' / > /var/tmp/output 2> /var/tmp/error
find / -type f | xargs grep -H -I -i -n 'root:x:0:0:root:/root:/bin/bash' > /var/tmp/output 2> /var/tmp/error
The -H and -n options preface each match with the file name and line number of each match, respectively. The -i option ignores case. -I (capital "I") skips binary files.
The problem: both commands doesn't finish.. They hang and I have to kill the processes after 15 minutes...
So, how can I solve it? I am expecting 'probably': /etc/passwd inside /var/tmp/output and a lot of denial permission errors inside /var/tmp/error. Right?
Thanks in advance!