If $SHELL contains /bin/bash it invokes sudo /bin/bash (see above). Sudo -s reads the $SHELL variable and executes the content. So you are root, but in the environment of the calling user. bin/bash is started as non-login shell so all the dot-files are not executed, but bash itself reads. Sudo /bin/bash This means that you call sudo with the command /bin/bash. login will be read and executed by the shell. This means that login-specific resource files such as. Sudo -i It is nearly the same as sudo su - The -i (simulate initial login) option runs the shell specified by the password database entry of the target user as a login shell. bashrc are executed and you will find yourself in root's home directory with root's environment. You can see that after switching to root you are still in the same directory: sudo su - This time it is a login shell, so /etc/profile. Bash is called as interactive non-login shell. non-interactive shell: A (sub)shell that is probably run from an automated process.interactive shell: A shell (login or non-login) where you can interactively type or interrupt commands.The sudo command has existed for a long time, but Ubuntu was the first popular Linux distribution to go sudo-only by default. When you open a graphic terminal in gnome it is a non-login shell. The su command is the traditional way of acquiring root permissions on Linux. non-login shell: A shell that is executed without logging in, necessary for this is a currently logged-in user.When you hit ctrl+ alt+ F1 to login into a virtual terminal you get after successful login a login shell. login shell: A login shell logs you into the system as a specified user, necessary for this is a username and password.It's important to understand the difference between login, non-login, interactive and non-interactive shells: bash - A text-interface to interact with the computer. The su+sudo escalation method is used to switch to an account that is allowed to run commands via sudo, then run a single command using a third privileged account without knowing the privileged accounts password.By default, Ubuntu "remembers" your password for 15 minutes, so that you don't have to type your password every time. This user must be in the sudoers file (or a group that is in the sudoers file). But unlike su it prompts you for the password of the current user. sudo - sudo is meant to run a single command with root privileges.su asks you for the password of the user to switch, after typing the password you switched to the user's environment.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |