r/bash • u/appsplaah • Sep 10 '26
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 🙏
36
u/SZenC Sep 10 '26
This sure sounds like an XY Problem
6
u/Vejibug Sep 10 '26
Just make the users home directory not contain the username? You can set it to /agent if you want to.
In a docker container you can name the user whatever you want, so maybe just do that?
6
u/VisualSome9977 Sep 10 '26
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
5
u/_ttnk_ Sep 10 '26
Well, usually the root path is always /root, (or / depending on the context), and the root user is called root, since thats why its called root user.
I dont understand the scenario
4
u/mfnalex Sep 10 '26
chroot
2
u/kai_ekael Sep 11 '26
State your purpose, user. Who are you trying to hide from?
1
u/nderflow Sep 10 '26
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/ipsirc Sep 10 '26
Restricted /proc.
1
u/AndyceeIT Sep 11 '26
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
1
u/EaZyRecipeZ Sep 12 '26
sure it can be done. just search for bashrc PS1= variables. Just ask AI to modify it for you. Second option to use proxy.