Shared directories?

I’ve added a user to one of my machines in order to play around with a new DE. I want the two user accounts to have separate directories under /home in order to keep all the dotfiles separate, but I’d like them to effectively have the same Documents, Pictures, Music, etc. directories. Can I just replace one set of those directories with symlinks to the other and set the necessary permissions? Are there any problems with that scenario that I’m not anticipating? Is there a better or easier way to accomplish this? Thanks.

If you don’t want the files and folders to be world accessible (a no-go imo), you’ll most probably run into some owner related permission issues. E. g. not being able to edit or delete files created by others.

If you want several users to have different read/write/create permissions on the same data you’ll have to look into ACL’s (access control lists) and set up the folders accordingly. Mount-binds could be necessary too.

I use this kind of setup to share Videos, Music and Pictures between multiple users. It’s a pain to set up though; mainly because I always forget how I managed this years ago :grin: .


You can use group permissions for that. Have common group between both users and set the group permissions of related folders and their files accordingly. You probably must have the group permission also on the providing user’s “root” folder (e.g. in /home/noah).
Of course remove world permissions to those folders.

Then you can create the symlinks.

The only potential problem I can see is if the extra user does some crazy things with your files…
But even that can be solved by giving only read permissions to the extra user.

1 Like

Ha, I obviously wasn’t clear enough that both users are me, as this is mainly for the sake of playing around with a second DE (a second tiling wm actually). So I trust myself not to screw up my files any more so than usual. Thank you both.

Have you tried giving both users the same UID? I haven’t done it in a few years but it worked last time I tried.

1 Like

Then your question is easy.
Just create a new group and make both users belong to that group. Then change the permissions of your (original) folders to have appropriate permissions for the new group.
Then create the symlinks from the other user to the folders of your original user.
Should work OK.

The problem with that approach is that as soon as something gets written without group write permissions it all falls apart.

That is why I used to share UIDs. It basically gives both users identical permissions but separate home directories.


There are sticky permissions that can be used e.g. for the group. That should solve the problem, right?

That should simplify things in this case where the users will never be on the system at the same time. Never would have thought of it though! It actually allows this? Just force the uid value in the useradd command? That and soft links should make it work fine…


Well… you can start e.g. two terminals and use different usernames on them… for example
with su username.

1 Like

I suppose so - but why? :grin:

Indeed, I just tested it, it works fine.


Using this command

sudo useradd -u 1000 -g evan -m nave -o

There will be some oddities like it may sometimes show the wrong username when it does a UID lookup but I never had any real problems. I used it to manage multiple DEs in their own user accounts back when I was a multi-DE fiend.

Because you can? :wink:

Interesting - I knew numeric user ids can easily be exploited, but I thought the system prevents creating another user with an existing user id.

As you said, some commands may display wrong user names, but I guess that is (fortunately) the biggest issue.

In the old days many *nix systems shipped with ‘root’ and ‘toor’ users which both had UID 0. The point of this was to allow you to have two different shells for root. Generally, sh for root and something more fully featured like csh or ksh for toor.

1 Like

I recall that - but I guess I didn’t make the association with uid’s at the time… :grin:

Another day, another tidbit of knowledge…

So having the same user id is the simplest solution for this question. :vulcan_salute:

OK, so just to make sure I understand, I create a user with a new name but the same id? Will they then have the same home directories?

I tried to create another user with an existing user id, but both useradd and usermod prevented that…

Maybe there’s some trick, @dalto ?

Use useradd -o

I posted a full example above.