System information

Adding a system user
The Ubuntu server install process asks you to add a system user other than root, but
CentOS does not. In order to be consistent in the book and to be more secure, we’re
going to add another system user and provide it sudo access.
§
To add the new user,
execute the adduser command:
# adduser asteriskpbx
# passwd asteriskpbx
Changing password for user asteriskpbx.
New UNIX password:
Retype new UNIX password:
Now we need to provide the asteriskpbx user sudo access. We do this by modifying the
sudoers file with the visudo command. You’ll need to install visudo the first time you
use it:
# yum install sudo
With the sudo-related applications and file installed, we can modify the sudoers file.
Execute the visudo command and look for the lines shown below:
# visudo
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
With the %wheel line uncommented as shown in our example, save the file by pressing
Esc
, then typing :wq and pressing Enter. Now open the /etc/group file in your favorite
editor (nano is easy to use) and find the line that starts with the word wheel. Modify it
like so:
wheel:x:10:root,asteriskpbx
Save the file, log out from root by typing exit, and log in as the asteriskpbx user you
created. Test your sudo access by running the following command:
$ sudo ls /root/
[sudo] password for asteriskpbx:
After typing your password, you should get the output of the /root/ directory. If you
don’t, go back and verify the steps to make sure you didn’t skip or mistype anything.
The rest of the instructions in this chapter will assume that you’re the asteriskpbx user
and that you have sudo access.
One last thing needs to done, which will allow you to enter commands without having
to enter the full path. By default only root has /sbin/ and /usr/sbin/ in the default system
PATH, but we’ll add it to our asteriskpbx user as well since we’ll be running many ap-
plications located in those directories.
§ sudo is an application that allows a user to execute commands as another user, such as root, or the superuser.
Distribution Installation | 39