sudo - command usage

Hi,

I have few doubts regarding "sudo" command. It acutally allows access to other commands as a different user. It stands for "superuser do".

Now, we execute a command as

sudo su - oracle

Can you please tell me what does it do actually, thank you.

If you are allowed to run :

sudo su - oracle

then it runs the command

su - oracle 

with root privilege, so it allow you to switch to oracle user without having to provide the password of oracle user account

I will add the - sign there is so it executes the .profile of the user in order to have his environment... in other words without - you would just "be" oracle from then on but without his environment ( most certainly most admin commands of a DBA would not load etc...)

You may want to check out your sudoers (/etc/sudoers) file. That would specify the rules for sudo on your system.

Thank you all, it is quite useful.

---------- Post updated at 03:09 AM ---------- Previous update was at 02:58 AM ----------

Hi,

What are all the other commands, which can be executed through 'sudo', please share more details, thank you.

Pretty much any command can be executed using sudo. Just depends on how it was implemented on your system.

sudo is configurable. /etc/sudoers determines who can execute what commands with it.