How to use sudo

  • To give sudo permissions to a user, say joe, add the user to the sudo group:
$ sudo adduser joe sudo
  • To run a command as superuser:
$ sudo some_command
  • To run a command as another user, say joe:
$ sudo -u joe somecommand
  • If you want to execute many commands or need a shell with superuser:
$ sudo -s
  • To list of commands allowed for you:
$ sudo -l
  • To list the commands allowed for another user, say joe:
$ sudo -l -U joe

Tried with: Ubuntu 14.04

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s