gigatore.blogg.se

Su vs sudo su
Su vs sudo su













su vs sudo su

#SU VS SUDO SU PASSWORD#

Sudo is used to run any privilege command with root privilege and asks current user logged-in password (and also checks if you’re allowed to run commands as root, which is configured through /etc/sudoers - by default all user accounts that belong to the “root” or “sudo” groups are allowed to use “sudo command”). Note: If you don’t mention username after “su -” then Linux system will assume that you want to switch to root account and will ask root password. Now run “su -” command to switch user su - /home/user2 -> User directory changed because it opens an interactive login shell Linux “su -“privilege command opens an “ interactive login shell” that is used to switch user ( root or any standard user ) and change the current user home directory. Note: If you don’t mention username after “su” then Linux system will assume that you want to switch to root account and will ask root password. Now run su command to switch user su /home/user1 -> User directory does not change because it opens an interactive non login shell I am logged in as user1 in terminal /home/user1 Linux su privilege command opens an “ interactive non login shell” that is used to switch user ( root or any standard user ) but do not change the current user home directory. 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.When you open a graphic terminal in gnome it is a non-login shell. 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.Lets explain the difference between following Linux privilege commands:īefore going to Privilege command need to understand the type of login shell in Linux system Today i will explain which command you should use to get right privilege at right time to execute your task. Do you know, you can get superuser privilege on your Linux system to just execute two commands but surely you don’t know about what is difference between Linux super privilege commands su, su -, Sudo su, sudo su-, sudo -s, sudo -i or sudo /bin/bash so on.















Su vs sudo su