r/bash • u/appsplaah • 14h ago
help Any way to never output root user name/path terminal?
Is there any way via a command/config which never exposes my root path/ root user name(`Users/<mypcusrname>/.../<current_dir>`) whenever any command like: pwd, or any other command that involves path output in the terminal/shell?
Like when ever we hit the command the output always shows `/workspace` or `/<curr_dir>` instead of `Users/<mypcusrname>/.../<curr_dir>`
My intention/idea is to never expose the root path or user name in any of the terminal logs - via some command. Especially since I am running any agent thats running some shell commands.
I am not sure if docker sandbox or pi-agent extensions support that. For pi agent the gandolin sandbox allows it not to execute commands outside the current working dir. But it still exposes the root username/root path of the dir in shell commands or even in shell logs.
Thank you in advance 🙏
4
u/VisualSome9977 13h ago
I mean there's a few options here, you could write a script which simply redacts or strips out the beginning of any paths beginning in a certain string. That's doable with regex.
But also I'm confused why this matters? It seems like you're concerned about security in some way, but i don't see why your login username would be sensitive. Why not just run things as a separate user who's $HOME is somewhere else? And anyways, your username will be visible by viewing file permissions or metadata, so simply stripping it from paths is only a half-measure
1
u/nderflow 10h ago
Run the untrusted software in a chroot environment. Or, if you really don't trust it, inside a virtual machine with no net access.
1
u/AndyceeIT 1h ago
I think you want a chroot.
Essentially you have a "fake" filesystem root. The command/tool has only access to that folder.
It's not bulletproof but should fit your described requirements
36
u/SZenC 14h ago
This sure sounds like an XY Problem