![]() In distros like Fedora, a person needs to create different passwords for root and user accounts. The sudo command is to execute one command with permissions of any user. If the user executing su isnt the root, he have to enter the password of the user he want get identity. This way, Ubuntu encourages a user to avoid logging in as a root user. The su command it to temporary change an identity to any user on a system and execute many programs with his/her/its permissions. sudo attempts to change to that users home directory before running the shell. The command name argument given to the shell begins with a - to tell the shell to run as a login shell. The system will prompt you for your password. In Ubuntu and many other Debian-based distros, the user needs to remember just a single password. i The -i (simulate initial login) option runs the shell specified in the passwd (5) entry of the user that the command is being run as. su The ' - ' means that youll have the same environment as you would if you logged in directly as root. One needs to assign a password to the root account to log in as root. When one installs Ubuntu Linux, the root account is created without any password. Ubuntu was the first widely used Linux distribution that adopted sudo-only approach by default. Also, sudo doesn’t activate the root shell and runs a single command. On the other hand, su forces one to share the root passwords to other users. For detailed information on sudo, you can read our detailed article written by Devin - Sudo in LinuxĬomparing the both, sudo lets one use the user account password to run system command. bashrc script will be run before executing the su - root command. su - root Will switch you to root, you will have to know roots password. ![]() The man page for su describes the behavior as: Provide an environment similar to what the user would expect had the user logged in directly. Passing a single hyphen is identical to passing -l or -login. When a user runs a command with sudo, e.g., sudo command, he/she needs to enter the current user account password to run it as root user. Sudo uses a config file (/etc/sudoers) to define the rights of different users. sudo su lauches su directly with super user privileges, while sudo bash lauches the shell first and then executes the command with bash -c. When you provide a double-hyphen the experience you will have is identical to if you had just executed sudo su without any hyphen. On the other hand, sudo runs a single command with root permissions. Critically, the significant way sudo su and su differ comes down to which password we need to enter.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |