Take a look at the / proc pseudo file system .
Inside this there is a subdirectory for each running process - the [pid] process has its information available in / proc / [pid] /. Inside this directory, you can use / prod / [pid] / stat / or / proc / [pid] / status to get information about which user started the process and when.
I'm not sure if assignment means "protected file", but if you have a way to determine which files are safe, you get information about open files (including their names) through / prod / [pid] / fd / and / prod / [pid] / fdinfo.
Is / proc sufficient for true security logging? No, but / proc is enough to get information about which processes are currently running on the system, which is probably necessary for homework about shell scripts. Also, outside this class, you will probably find / proc useful later for other purposes, such as viewing the displayed pages for a process. This can come in handy if you are writing a stack trace utility or want to know how they work, or if you are debugging code that uses memory mapped files.
source share