• I am on linux machine ubuntu distro.
  • I don't have root/admin privileges-just a standard user.
  • I mostly use bash shell.
  • The directory /ts already exists. I only have read only access to this directory.

When I ssh into this linux machine, I want /ts to refer to ~/.local/ts. eg. Given the directory/file structure below:

├── ts
|    └── A.sh
├── home
     └── rtetteh
            └── .local
                   └── ts
                        └── B.sh

When I execute ls /ts I want to see B.sh. When I execute cd /ts I want to be in ~/.local/ts.

Not limited to only the examples above, I want /ts to reference ~/.local/ts in all scenerios. I only want this for myself. I dont want to change any behavior for other users on this linux server.

I did some research and got exposed to mount --bind but this requires root/admin privelages and I am sure this specific technique will affect other users too which is not what I want. I also saw something about bindfs but not totaly sure still researching.

  • What you're trying to achieve will affect the system globally. There's no way to create the type of linking you're looking to achieve that won't have system-wide access ramifications.
    – Thomas Ward
    Commented Jul 9, 2023 at 1:56
  • You can use a private mount namespace - that will require admin access but won't affect other users, e.g., askubuntu.com/a/1074456/158442
    – muru
    Commented Jul 9, 2023 at 2:18

1 Answer 1


What you want is possible by utilizing kernel namespaces capability and IMO if you recreate your filesystem namespace from scratch which requires some plumbing ... However, luckily, there is a tool from the package bubblewrap that can do that fairly easy:

bwrap is a privileged helper for container setup. You are unlikely to use it directly from the commandline, although that is possible.

It works by creating a new, completely empty, filesystem namespace where the root is on a tmpfs that is invisible from the host, and which will be automatically cleaned up when the last process exits. You can then use commandline options to construct the root filesystem and process environment for the command to run in the namespace.


bwrap --die-with-parent --bind / / --dev-bind /dev /dev --bind /home/rtetteh/.local/ts /ts -- /bin/bash

Is the minimum example(as I see it) to do what you want ... Read the manual and expand that example with more options as you need like for example --setenv VAR VALUE to set environment variables when needed.

If you need to add more bind mounts, then you can add them before the last -- in the form of --bind SRC DEST ... And you will always need --bind / / --dev-bind /dev /dev so don't remove or modify them.

Needless to say that you can't use system directories like /etc, /bin or /var ... etc. as target mount points for other directories or otherwise your newly created filesystem namespace will become unstable and probably unusable.

That wont affect other users or the system services and will only affect the newly created filesystem namespace.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .