I want terminal commands and shell logs—such as pwd or commands that print file paths—to show a neutral path like /workspace or /current_dir instead of exposing my real home directory and username, such as /Users//... . This is especially important when an automated agent runs shell commands and records their output. Is there a shell configuration, command, container setup, or sandboxing approach that can prevent the real path and username from appearing?
3 Answers
The cleanest solution is to run the agent as a separate user whose home directory has a neutral name, such as /agent or /workspace. In a container, you can create a user with whatever username and home directory you choose, then run the agent there. This prevents most normal path output from revealing your actual account name.
If the goal is isolation from untrusted commands, changing displayed paths is not enough. Run the software in a container, chroot-like environment, or preferably a virtual machine with restricted networking and only the required directories mounted. That gives the agent a separate filesystem and makes its visible paths naturally different.
You can redact a known path prefix from logs with a wrapper script or regular expression, replacing something like /Users/ with /workspace. However, this is only cosmetic: usernames and paths may still appear in file ownership, metadata, error messages, environment variables, or other command output.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures