I've written an install script on a server to quickly set up new sites in the /srv directory. It needs to do a git clone
, and has to be run via sudo
in order to have the permissions to do all the things it needs to do (create directories in /srv, create a new VirtualHost, restart Apache, etc).
The question I have is simply this: at the moment the root user has no SSH key, but I'll need one in order to git clone
from BitBucket. Are there any security issues with generating one? That is, if I run ssh-keygen
as root so I have public and private keys for the root user, will I be making the server less secure in any way?
Incidentally, this is a script that is already in use and has been working fine, but until now the repo I'm cloning from has been a local one, hosted on the same server. I've recently switched to hosting it remotely (on BitBucket), so I need a "deployment key" in order to git clone it.
sudo
to the root user to accomplish this. Change the ownership and permissions on the subdirectory of/srv
you're deploying these sites to, do the same for the directory where Apache configurations are stored in, and configure/etc/sudoers
to allow this user to restart apache.ssh-keygen
for the root user.sudo
ing my install script when I need to would work without any risk of unforeseen consequences.ssh-keygen
for the root user" then perhaps you should edit the extraneous details out of the question to get away from the specifics of your situation. Otherwise you'll continue getting alternate solution suggestions.