I need to run a few commands with sudo. These commands are located either in
~/bin, and stored in a git repository (i.e. dotfiles).
I've placed symbolic links in
~root pointing to my user's
$HOME, but I think it isn't great security-wise doing so, so I removed them.
My concern is that if a non-root user have write permissions for these files, a malicious program could manage to perform privilege escalation. Yet I find many dotfiles repositories which are unsafe in my book.
.bashrc, sudo commands can be on
/etc/sudoers with NOPASSWD. On
bin/*.sh scripts, I was thinking in omitting sudo from commands and chown them to root, but this can be an issue since git doesn't store ownership. (Almost) all individual command require sudo anyways, so I guess technically it's the same, except assigning scripts to root should be safer. Git would cause some trouble I guess.
A thought: if I granted every single command on
/etc/sudoers with NOPASSWD, then if root password was requested, I would smell something was off.
- This is for a couple local, single-user machines;
- Unauthorized access to my desktop computer isn't an issue, so I have autologin set up;
- My laptop requires password for starting a session.
If the question is not clear by now, I ask, how can I arrange these scripts/commands in a safe way? Could privilege escalation with root be more harmful than a malicious program on my own user's data? Maybe I'm just overthinking it?