3 ms·
In case the author reads this: "use `sudo su`" - this is unnecessary. Sudo already gives you root here. You can use `sudo -i` to get a login shell directly.
by viraptor 3y ago
In case the author reads this: "use `sudo su`" - this is unnecessary. Sudo already gives you root here. You can use `sudo -i` to get a login shell directly.
- georgyo 3y agoThat's a hyper specific nit you got there, and only referenced once in the middle of the article. However sudo -i, sudo su, and sudo su - are all common ways to achieve the desired result, with very subtle differences. Sudo su - is my preferred method because it puts you into a root login shell rather than just a shell with root privileges. But these are all pretty pandantic to call one way correct, and others incorrect.
- zokier 3y agosudo -i specifically invokes login shell: > Run the shell specified by the target user's password database entry as a login shell. Contrast to -s option: > Run the shell specified by the SHELL environment variable if it is set or the shell specified by the invoking user's password database entry
- viraptor 3y agoIt's not that it's incorrect, it's just unnecessary, same as "sudo sudo". I keep seeing those in various places and when people learn that they trip up in environments where there's no "su" available.
- yjftsjthsd-h 3y agoActually in this specific case I'm not sure why you wouldn't just run `sudo nixos-rebuild [...]`; there's no point in getting a root shell for a single command.