Sudoers also allows you to decide what others can do. If you authorize people with sudo, you just update the sudoers file to add or remove people and they only have to remember their own password. Lastly, for su you give the root password around and have a maintenance pain. On Fedora and CentOS, use DNF to install doas: sudo dnf install opendoas. To install it on Arch, just use pacman: sudo pacman -S opendoas. Note that the package is only present in the Ubuntu 21.04 repository and not in the 20.04 LTS release. That means your aliases and such will be available.Īlso, auditing results are different in the audit logs when using su versus sudo. To install doas on Debian-based distros like Ubuntu: sudo apt install doas. But "sudo su other_user" carries your environment forward under the UID of other_user. The environment is controlled like this "sudo su - other_user" gets the environment for other_user. That is almost identical (maybe is, I am not sure) to "sudo -i". which must be known.ĭepending on options you can pick up roots environment or carry yours forward. When you make a purchase using links on our site, we may earn an affiliate commission. Which one should you use depends on the task at hand. The sudoers file defines what commands you are allowed to execute using sudo. Secondly: sudo -i and su - do the same thing ( su - is equivalent to su -login ), using different authorization mechanism: su verifies the password for the root account, while sudo verifies the password for your current user account and also verifies that your current user account is allowed to run administrative operations according to the. su: Which Command Should You Use By David Delony Published On Linux, there are two commands to get superuser access: su and sudo. It can also be useful if you have multiple users who need various permissions.Another difference the sudo command uses YOUR password and you have to be authorized in the /etc/sudoers file. It may be that the account was named root due in part to the fact that only the superuser has write. In this respect they are one and the same, though there is no rule that I know of that says that the superuser account must be called root. Does he/she want to deal with one password or two? Technically, an administrator can decide to use both on the same server and use the one that is most beneficial at the time. root is traditionally the name given to the user account with superuser level rights. Suffice it is to say that it ultimately depends on the preference of the system administrator. 'su -' gives you roots environment also-just as if you had logged in as root. There are security benefits to each, and the argument over which is better can get heated. Rep: 'su' gives you root powers, but keeps your regular user environment. With “sudo” only commands with those words in front of it will be administrative preventing the user from accidentally running a dangerous command as root. With “su”, root is a true separate user, and some administrators find it more useful to be able to log in as root and run several commands. There are benefits and drawbacks to each. Certain distributions, such as Ubuntu use “sudo” by default, while others, such as CentOS, prefer “su”. Instead, the user prepends “sudo” before a command that needs root privileges. I looked for how to specify an alternate user data directory with the -user-data-dir argument but I didnt find much. To run as root, you must specify an alternate user data directory with the -user-data-dir argument. The “sudo” command is an alternative to using a separate root user with its own password. It is recommended to start vscode as a normal user. A secure SSH server will not allow direct root login, so the user must gain root after initial login. The “ su” command is what a Linux user with proper permissions uses to ascend to the root administrator account.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |