The problem with running a network facing daemon as root, is that if in the future there is an exploit found for that daemon then potentially an attacker could execute code on your machine as root. This gives the attacker unlimited accesses to your machine. To fix this you would need to create a user/group that your daemon can run as and also assign that user/group to the files your daemon needs to access. This prevents an attacker from having free reign over your computer should he exploit that daemon.
To create a user/group for your daemon called user bitcoin
you can run the following:
$ sudo useradd -U -r -s /bin/false bitcoin
-U
create a group named bitcoin
-r
create a system account
-s /bin/false
sets the login shell to /bin/false (this way no one can potentially login with this user and get a shell
Now lets say you have chosen to store all the bitcoind related files in the /var/lib/bitcoind directory.
$ sudo mkdir /var/lib/bitcoind
$ sudo chown -R bitcoin: /var/lib/bitcoind
This will set bitcoin
user and bitcoin
group as the owner of all files within that directory as well as the directory itself.
When you run the bitcoind daemon you need to tell it to run as user bitcoin
and to use /var/lib/bitcoind as it's data directory. Make sure your files like your wallet or blockchain data are inside /var/lib/bitcoind. Your bitcoin.conf is expected to be stored at /etc/bitcoin/bitcoin.conf in the following system script.
Now you just need to install a script that will start your daemon for you with your intended user. To do this please read the instructions (chances are you are using systemd so follow those instructions): https://github.com/bitcoin/bitcoin/blob/master/doc/init.md
I hope this helps!