Tuesday 6 March 2012

Command Line | Superuser Privileges Commands ” su & sudo “

Become a superuser or having administrations privileges through command line is mostly used daily to install extra applications, modifying files require a superuser, access to certain applications or changing password for currently available users by authenticating root user. So here we will take a look at most daily used administration privileges.

Different Usage for su and sudo ” sudo vs su “

sudo command used on many distribution these days such as Ubuntu, many users prefer sudo as default administration privilege access, but the administrations privileges gained using sudo command are for the same user account already running, otherwise su command it’s completely separated root account with different password used in many distributions such as Fedora centOS, and Redhat.
Also check a brief wikipedia informations showing different between su and sudo in different distributions Here.

Example for using su on Fedora

I am Using fedora now and I want to modify my repository list so let’s try to gain access to it using sudo, it will check if the currently running user is have administration privileges as shown in screenshot 1, and it will prevent you to save the modified file. So you will have to gain access to root account using su command, then start typing the command for modifying the repository list using nano text editor for example.
Otherwise if I am using Ubuntu and tried to modify my repository file list, it will simply work with sudo command it will give currently running user a root privileges.
so let’s try some of the daily used administration commands used on my machine.
su
simply access root account after typing the password.
sudo "command"
To run a command with root privileges, just for this command not full session,Ignore quotes.
gksudo nautilus
If you usually don’t like to use command line interface cli, you can use this command to access gnome nautilus file manager with administration privileges.
kdesudo konqueror
Similar to gksudo but for KDE desktop and using konqueror file manager.

No comments:

Post a Comment