Create another shortcut `~~` like `~` (home directory)
Actually, there is a way, it's not a great way, but it's a way, haha!
Add the following to your
~:x:1111:99:special Character user:/test:/sbin/nologin
1111 as the UID with something that makes sense, replace
/test with the directory you want ~~ to mimic.
99 on my system is the
nobody group I recommend if you do do this to make sure it's a group with NO permissions on any file that will ever get used. Theoretically with
/sbin/nologin as the shell, it should not be able to be used, it also will not have an
/etc/shadow entry so it won't have a password. Theoretically should be fine, but make sure that it doesn't somehow let you log in as the account.
As a side note: I am not in any way saying this is a good idea, but it will accomplish the functionality that you want.
EDIT: For completeness’ sake this was suggested by VarunAgw:
You could add the user as normal with
useradd -s /sbin/nologin -N tmp and then modify
/etc/shadow to change the user
~ and change the location of the
You can make use of CDPATH and put a directory literally named
~~ in one of your CDPATH components.
man bash (but CDPATH is available even in
The search path for the cd command. This is a colon-separated list of directories in which the shell looks for destination directories specified by the cd command. A sample value is ".:~:/usr".
That will allow you to do
If you want to do things like
vi ~~/someFile from anywhere in the directory tree, then you're out of luck if you insist on
~~ literally unless you hack your shell, however, you can use variables or environment variable to store your magic directories so you can do, e.g,
I usually put often-accessed files inside shortly named directories in my home directory so I can access them with paths such as
Naturally, you can usually replace directories with symlinks to directories as much as you want.