Hello everyone,

For those who are interested, i would like to highlight the differences between using ‘sudo’ and ‘su -c’ commands.

Although, it will be applicable to all linux distributions, in this blog i am going to concentrate on Ubuntu & Fedora.

1) Required Password:

  • ‘sudo’ requires current user password.
  • Whereas, ‘su -c’ requires root user password. (This is no coincidence. Infact, this was the very reason for introduction of sudo command).

 

2) Operational Speed:

  • ‘sudo’ command is slower in operation as compared to ‘su -c’ command.
  • (In the normal course of action, you might even not notice it. But, try using it over SSH or for SE-Linux like operations, you will notice the difference.)

 

3) It’s working:

  • On issuing the ‘sudo’ command, os checks the sudoers file in /etc directory for a flag which tells is whether or not root like permission should be given to current user.
  • On the other hand, when ‘su -c’ means, switch to super user(root) and -c switch says, only for this command.

 

4) Time Duration:

  • Since, ‘su -c’ command elevates permission for only specified command, you need to enter root password, each time it is used.
  • Whereas, on entering password for sudo command, it gives root like permissions for about 5 minutes. i.e. you don’t need to enter password again if you issue sudo command again.

 

I sincerely hope you liked it. Please leave your valuable comments and suggestions.

Difference between ‘sudo’ & ‘su -c’ commands
Tagged on:                         

One thought on “Difference between ‘sudo’ & ‘su -c’ commands

  • November 23, 2016 at 2:01 am
    Permalink

    thank you pal, I was searching about that , was confused.

    Reply

Leave a Reply

Your email address will not be published.