0

I created 5 new users in Fedora. However, all this has to be appended to a log file. One of the requirements for the assignment is to append /etc/passwd and /etc/shadow files into a log file. I am logged in as the admin in root and when I try something along the lines of:

/etc/passwd >> file.log

I get a permission denied message. How would I be able to post the contents of these files into my log file?

1

The command:

/etc/passwd >> file.log

attempts to execute the /etc/passwd file, but /etc/passwd is not an executable, hence the permission denied error.

To redirect the contents of the file, you can use cat:

cat /etc/passwd >> file.log

(In fact, you could use any other command that reads files and outputs their contents on standard output, for example sed '' /etc/passwd or awk 1 /etc/passwd).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.