0% found this document useful (0 votes)
57 views

Exercise: Using Sudo To Manage Access To The Root Account

The document describes how to use sudo commands to manage access to the root account without knowing the root password. It provides steps to: 1) Check if a user has sudo privileges by running commands as the user. 2) Add sudo privileges to the user if needed by editing the /etc/sudoers file as the root user. 3) Use sudo to switch to the root user without knowing the password. 4) Use sudo to change the root password without knowing the current password.

Uploaded by

boewulf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views

Exercise: Using Sudo To Manage Access To The Root Account

The document describes how to use sudo commands to manage access to the root account without knowing the root password. It provides steps to: 1) Check if a user has sudo privileges by running commands as the user. 2) Add sudo privileges to the user if needed by editing the /etc/sudoers file as the root user. 3) Use sudo to switch to the root user without knowing the password. 4) Use sudo to change the root password without knowing the current password.

Uploaded by

boewulf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Exercise: Using sudo to Manage Access

to the root Account


1. Logged in as your default user, use the sudo command to list
the contents of the '/var/log/syslog' file and note the result.
user@user:~$ sudo cat /var/log/syslog
or
user@ user:~$ sudo more /var/log/syslog
user is not in the sudoers file. This incident will
be reported.
2. Become the root user on the system. Determine if the
user user has sudo privileges. If not, grant them by adding them
directly to the appropriate file or to the appropriate group. Verify
by logging back in as user and rerunning the command from
Step 1.
user@ user:~$ su -
Password:
root@ user:~# cat /etc/sudoers | grep user
Does the user user appear in the results? Check for groups
that have sudo rights.
root@ user:~# cat /etc/group | grep user
Does the user user appear in any groups that have sudo
rights in the above sudoers file?
If neither of the above has the correct entry, add the user to
'/etc/sudoers' under root or add to the wheel group and be
sure wheel is uncommented in '/etc/sudoers'.
root@ user:~# exit
user@ user:~$ sudo cat /var/log/syslog
Aug 8 07:59:46 user anacron[12757]: J ob
`cron.daily' terminated
Aug 8 07:59:46 user anacron[12757]: Normal
exit (1 job run)
Aug 8 08:00:36 user
com.ubuntu.OneConf[2513]: WARNING:oneconf.hosts:Error
in loading other_hosts file: [Errno 2] No such file
or directory:
'/home/user/.cache/oneconf/80847e55eaa94d66b911b4cd8c917b24/other_host
s'

3. As the default user, execute the appropriate command


using sudo to become the root user without having to know the
root password.
user@user:~$ sudo su -
[sudo] password for user:
root@user:~#
4. Using the user account, execute the proper command to
change the current root password without knowing it. Once
changed, verify the password by executing a su to the root
account.
user@user:~$ sudo passwd root
[sudo] password for user: (enter 'user ' password
here)
Enter new UNIX password:
Retype new UNIX password:
Password Updated.
user@user: ~$ su -
Password:
root@user:~#

You might also like