It can also be useful if you have multiple users who need various permissions. sudo is more secure that su, as sudo uses users password (note only those with appropriate privileges can use sudo), therefore we do not have to distribute a new root password every time someone leaves the group. 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. ElectricCoffee Both are unsafe: Having a root shell is unsafe One slip of the fingers can cause a lot of damage. Suffice it is to say that it ultimately depends on the preference of the system administrator. There are security benefits to each, and the argument over which is better can get heated. 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. In other words, the tool lets you assume the identity of some other user without having to logout and then login (as that user. The main work of the su command is to let you switch to some other user during a login session. 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. In this article, we will discuss in detail the ‘su’ command as well as how it differs from the ‘sudo’ command. There are benefits and drawbacks to each. If that is correct, then the difference in PATH lies in the configuration files: /etc/profile, /.bashprofile, /.bashlogin, /.profile are executed (in that order) for a login shell, while. Try again with sudo bash -l and you should see the same result as su. Certain distributions, such as Ubuntu use “sudo” by default, while others, such as CentOS, prefer “su”. Because when you use sudo bash, bash doesnt not act as a login shell. Instead, the user prepends “sudo” before a command that needs root privileges. sudo su will execute commands as root in your present working directory but sudo -i will take you to your root's home directory (by default to /root) Another difference is if you are using anything other than bash as. Surez T see Nieva JL Suarez V, Stachelin C, Arango R, Holtorf H. As pointed by the user user535733 in the comments section, both commands will take you to different working directory. 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. Su F see Lu L Su G see Schomberg SL Su GF see Chen HX Su H, Alroy G, Kirson ED. Passing a single hyphen is identical to passing -l or -login. The “sudo” command is an alternative to using a separate root user with its own password. When you provide a double-hyphen the experience you will have is identical to if you had just executed sudo su without any hyphen. A secure SSH server will not allow direct root login, so the user must gain root after initial login. parabile est, quod natura desiderat : ad su- pervacus sudatur, Sen. 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 |