execute remote commands with sudo
more and more I'm in situation where I don't get root with VM or it's even forbidden to do
sudo -i. there are many reasons for that. from overzealous security policy writes who see root as root of all evil to monitoring and auditability of operator actions. YMMV of course, but we can't ignore the fact that this is happening and it's a new norm just like Gospel of systemd brought to you by Church of Lennart.
fun fact is that
sudo is often allowed without password in situations where all non-system users present in system are admins anyway. shared systems with some users in sudoers group is different issue and isn't in scope imho.
what must be done:
- all necessary files must be copied to executing user's context in target host (
~/.cdist/exec?). imho that should be default even if we use root.
- directories and files in executing user context must be create without sudo
- remote code must be executed with sudo