![]() ![]() ![]() ![]() But if you run anything else, you’ll immediately notice how different things can be!įor example, let’s say you’re running the fish shell for your user account and keep the root shell in bash. In most instances, elevating to root through either shell will not result in any noticeable change. If you use an unmodified bash shell for your user account, the difference is mostly philosophical. This command summons a shell with your $SHELL variable. In simpler language: sudo -i will give you a “clean” root login in your “/root” folder, which is the “home” folder for the root user. Because of this, most people view it as the preferred method to gain root without logging in directly. This makes it much more challenging to figure out which environmental variables will be kept and which will be changed (when swapping to the root environment). To clarify: with sudo su, you’re using more than one root setuid command in the background. Where it differs from sudo su is that sudo -i is a much cleaner way of gaining root and a root environment without directly interacting with the root user. sudo -i is also very similar to using sudo su: it’ll read all of the environmental files (“.profile”, etc.) and set the environment inside the shell. Much like sudo su, the -i flag allows a user to get a root environment without having to know the root account password. Using sudo -i is virtually the same as the sudo su command with one exception: it does not directly interact with the root user. While you could do this in the meantime, you should still reset the root password at some point. This is useful in situations where you may have forgotten the root password if it’s different from the password for your user account. Root is given with sudo su by requesting the current user’s password, which makes it possible to gain root without the root password. Though there isn’t a large divergence between sudo su and su, the former is still a very useful command for one important reason: when a user is running su to gain root access on a system, they must know the root password. If any command is run with sudo in front of it, it is given root privileges. When sudo su is run, “.profile,” “.bashrc” and “/etc/profile” will be started, much like running su (or su root). It’s essentially the same as just running su in the shell, save for one crucial difference: instead of telling the system to “switch users” directly, you’re telling it to run the su command with superuser privileges. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |