4 ms·
I replaced "sudo" in all my systems a long time ago with an alias to "machinectl shell .host" which is IMHO far superior to it, as it doesn't just spawn a new s
by eliaspro 4y ago
I replaced "sudo" in all my systems a long time ago with an alias to "machinectl shell .host" which is IMHO far superior to it, as it doesn't just spawn a new shell as a privileged process, but instead initializes a full user-session and then spawns a shell in this user-session.
This doesn't carry the risk of tainting the new session with the context of the initiating shell (pwd, env, ...) and doesn't only feel like a full login, but actually provides everything that's part of a login session (systemd and DBus user-sessions, shared session context with other shells of the same user, etc).
- mid-kid 4y agoSudo's -i option is able to provide you with a shell in the same state that it'd be if it were a fresh login. I've burned this into my fingers a long time ago. Also, in most configurations you have to specifically whitelist environment variables for them to surivive a "sudo" call.
- sph 4y agoIs there another way of opening a root shell other than "sudo -i"? That's what I've been using for a decade. How do other people do it?
- TheAdamist 4y agosu -l root But that only works if theres a password on root, which is generally seen as ill advised. But was how every distro did it in the olden days before there was a sudo group.
- error503 4y ago`sudo su` is a way.
- doublepg23 4y agoI've always used sudo -s but no clue why.
- yjftsjthsd-h 4y agosudo su - Which also resets your environment and everything.
- TheGrassyKnoll 4y agoI had to: $sudo apt-get install -y systemd-container to get machinectl
- hot_gril 4y agoThis is going way over my head. Am I the only one here who just puts everyone in sudoers and does NOPASSWD? Where are these multi-user systems where you don't really trust everyone who has access?