For managing sites on my web server, I create a new user per site. They get a home directory where their public folder is located. From time to time I may be logging in as a site and would like to have my config/dotfiles available to work with. This is working fine with my single admin user, I am able to pull my git repo of dotfiles and update when there is a change. I added my dotfiles repo to /etc/skel
so it gets added to every new user. This is becoming a pain because now I can't do a git pull
because my public key isn't correct or something. Also, it will be a pain to go from site to site and update the repo. Is there a good way to handle this? Is there somewhere I can just symlink it to and have git access and write access with any account? I am the only user so far that will be logging in with a shell.
First of all you should be aware that some dotfiles need special permissions (e.g. 700 for
~/.ssh
) and that it's potentially risky and not desirable to share some of them between different accounts.That said, a possible approach depends on what you want to have in your user directories: the git repository of dotfiles or the dotfiles alone (without repository). For the first scenario you could pull your remote repository with your admin account (which you already do if I understand correctly). Once that is done, you can then clone/pull the repository for the other accounts. If it's not possible to pull the repo from the remote server (that seems to be your problem) you can just use your server-local repository. That one will just need read permissions for the users in question.
If you just want to have the dotfiles for the all the users (without repo) you could do a checkout from your server-local repository to a different work-tree, like
GIT_WORK_TREE=/path/to/home/dir git checkout -f
or usersync
to keep the files in sync. Take care that you get the permissions and ownership right for all this.Whatever approach you choose, it can be done manually or automatically using an appropriate script as git hook.