fokiinvestments.blogg.se

Su vs sudo
Su vs sudo











su vs sudo

Not sure if you'll get the same results with Ubuntu.Īt least one thing is different between "sudo su" and "sudo su -" The latter changes to root's home directory. "sudo su" and "sudo su -" But I'm using opensuse. I just ran a test and was surprised to find that the results of "env" were identical (including $PATH), when I used In places like /usr/sbin, which may be required to add/remove packages. If it doesn't, you may not be able to run programs Regarding "c," make sure your $PATH changes with "sudo su". I don't think it will matter for a, b, d, or e if you use "sudo su" or "sudo su -". would it make any difference if I'm trying to do under root: So when you run "sudo su - ", you get the same environment as if you had logged in as root, which might be important for at least one of the things on your list. And the hyphen is shorthand to "su" for the "-l" option, and " -l " is the short form of "-login". The hyphen " - " is an option to the "su" command, ie it is not an option to sudo. "su" is the command you are allowed to run via "sudo". The hyphen " - " is an option to "su", not to "sudo". And today I found out that there's also a sudo su - option. We also saw here, how we can enable access to these commands for different users.I've always been using either sudo or sudo su. ConclusionĪ specific shell is provided with the su command, whereas only temporary privileges are granted through sudo command. If you want to let another user have access to sudo command then, follow the article. Only the user we have created at the time of installation can have the access to sudo command. We would like to add here that, not all users have access to sudo command in Ubuntu. Otherwise, things would work just like it would for a regular user. So, through sudo command we can have superuser privileges only when we require. If we run another command in same shell without sudo, it would run as regular user. The privileges won't be permanent with sudo. But, when we run a command through sudo, it runs the command as superuser. With su command, we were provided root's shell which had all the privileges. sudo command is mainly used to grant temporary privileges to the regular user.

#Su vs sudo password

Once, we have set the root password - we are good to go. Therefore, we need to provide root password first in order to make it work. Reason: root password is not set during installation setup. It would throw an error if we try to access the superuser through this method - su: Authentication failure. It is worth mentioning here that, Ubuntu may not allow you to log in through this method. So, for example - if we want to log in as root user then, we would use - su -lįor other users, following would work - su -l But, we can also use the command to log in with other users as well. su (or substitute user) allow us to log in a user through a shell.īy default it logs in as root user. Difference between su and sudo command in Ubuntu In case you don't have one then, we advise you to contact your System Administrator for assistance.

su vs sudo

Note: Following operations would require you to have superuser privileges. Most of us who have access to superuser privileges would usually log in as regular user and then, use either su or sudo commands to execute administrative tasks. Therefore, we draw a line on who gets what while working on the system. Users who don't have enough experience in handling systems may inadvertently harm the system. To make sure the system is secure enough, we can't provide superuser privileges to every user. A system administrator gets the maximum number of privileges, this helps him/her manage the distribution better. Every user in a Linux distribution has certain privileges. In this article, we would cover the difference between su and sudo command in Ubuntu.













Su vs sudo