I would like to monitor a users current working directory. This is a learning app and I would like to know when the user was able to cd into a directory. Also this is in docker. I am root, but when I try to view other users cwd I get a permission denied.

root@e904b4825a3a:/app/node# ls -la /proc/4656/cwd
ls: cannot read symbolic link /proc/4656/cwd: Permission denied
lrwxrwxrwx 1 term term 0 May 24 02:10 /proc/4656/cwd

I've used several other ways to access the cwd file, but with the same result. Is there anyway to see other users cwd? Or can someone think of a work around?

Thanks in advance!


The process you are looking at may or may not exist. ...it would be easier to do this outside of the shell (ie) inside your tutorial. Can you modify the tutorial to say watch for when they put a file into the dir? Then you only need to look for a known file in a known location...

  • Sure I can do that, but then I'm testing if they are creating a file not if they are able to change directory. I want to be able to test if they were able to successfully cd into a directory. – randy May 30 '17 at 17:55
  • How about if you give them an alias or script that checks the path ie, $0? – Joey J May 30 '17 at 18:02
  • you mean creating an alias for cd that would print pwd somewhere after changing directory? I think something like that could work actually. Thanks for the thought. – randy May 30 '17 at 20:31

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.