Linux - SUDO - RootSudo - Advantages and Disadvantages - Commands etc... ?

| 2 1 2
Asked on 9/26/15, 3:59 PM

To use sudo on the command line, preface the command with sudo, as below: Example #1

sudo chown bob:bob /home/bob/*

Example #2

sudo /etc/init.d/networking restart

To repeat the last command entered, except with sudo prepended to it, run:

sudo !!


Allowing other users to run sudo

sudo adduser <username> sudo

where you replace <username> with the name of the user (without the <>).

In previous version of Ubuntu

sudo adduser <username> admin

would have been appropriate, but the admin group has been deprecated and no longer exists in Ubuntu 12.04.

Logging in as another user

Please don't use this to become root, see further down in the page for more information about that.

sudo -i -u <username>

For example to become the user amanda for tape management purposes.

sudo -i -u amanda

The password being asked for is your own, not amanda's.

root account

Enabling the root account

Enabling the root account is rarely necessary. Almost everything you need to do as administrator of an Ubuntu system can be done via sudo or gksudo. If you really need a persistent root login, the best alternative is to simulate a root login shell using the following command...

sudo -i

To enable the root account (i.e. set a password) use:

sudo passwd root

Use at your own risk! 

Logging in to X as root may cause very serious trouble. If you believe you need a root account to perform a certain action,please consult the official support channels first, to make sure there is not a better alternative.

Re-disabling your root account

If for some reason you have enabled your root account and wish to disable it again, use the following command in terminal...

sudo passwd -dl root

| 2 1 2
Answered on 9/26/15, 4:02 PM

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This forum is for HiTechnologia Employees & just Odoo general knowledge purpose only.

Read Guidelines

Question tools

3 follower(s)


Asked: 9/26/15, 3:59 PM
Seen: 6687 times
Last updated: 9/26/15, 4:02 PM