You are on page 1of 4

allow a user to use the sudo

command
1.

introduction

2.

edit the sudoers file

3.

test your work

4.

troubleshoot

introduction
An account is a set of details that describes a user to an OS (Operating System). Details
include a user name, a group that the user is a member of and a password that the user knows.
The OS uses an account's user name and group to decide whether a user is authorized to
perform an action. The sudo command allows a user to pretend she is someone else and
execute a command.
After allowing a user to use the sudo command you can change accounts using sudo.

edit the sudoers file


A special form of the vi editor called visudo is used to edit the sudoers file. This lives in
/opt/sudo/sbin.
Don't edit a sudoers file except the one on ics01. A central sudoers file is kept on on this
management station. This file is often copied out to all other hosts that the LIC support team
looks after.
1.

Open a CLI on ics01.

2.

Use sudo to switch to the root account.

3.

Edit the file.

root@ics01:>/opt/sudo/sbin/visudo
#######################################################################
#########

File:

/etc/sudoers

...
"/etc/sudoers.tmp" 129 lines, 5859 characters

4.

Create a user alias list.

User_Alias CUSTOMER01 =

c1cejon, c1cejane, c1cefred

If you are adding a user to an existing group, this is all you have to do. Skip to the end.
5.

Create a command alias list.

Cmnd_Alias SUC1IWS = /bin/su - c1apiws, /bin/su - c1foiws

6.

Create the privilege line.

CUSTOMER01 ALL=NOPASSWD:SUC1IWS

7.

Save your work and close the file.

:wq
"/etc/sudoers.tmp" 129 lines, 5869 characters
root@ics01:>

8.

Close the CLI.

test your work

1.

Open a CLI on ics01.

2.

Use sudo to switch to the user's account.

3.

Use sudo and a command in the Cmnd_alias list.

c1cefred@ics01:>sudo su - c1apiws
Uptime: 12:36pm up 95 day(s), 12:24, 33 users, load average: 0.20,
0.24, 0.28
c1apiws@ics01:>exit
c1cefred@ics01:>

4.

Close the CLI.

troubleshoot
Asked for a password
You may not have permission to do what you are trying to do. Press return to exit sudo.

c1apiws@ics01:>sudo su -

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these two things:

#1) Respect the privacy of others.


#2) Think before you type.

c1apiws@ics01's Password:

You might also like