Preparing a Virtual Private Server

The Virtual Private Server for www.istarelworkshop.com is built on the Ubuntu 8.0.4 (hardy heron) 64-bit minimal operating system.

Establishing the VPS Setup

When a Virtual Private Server is first prepared, root is granted ssh access to the server. The first tasks I want to complete are to provide a new password for root, to create a different user on the server, and to disable root ssh access.

ssh root@74.126.25.201
passwd

I will create a user named iwuser, set a new password, and make bash the default shell.

root# useradd -m iwuser
root# passwd iwuser
root# which bash
/bin/bash
root# chsh -s /bin/bash iwuser

The -m switch tells useradd to create the home directory. To see the defaults that useradd will use, simply issue the command useradd -D. I want to have iwuser as part of the sudoers group. I will create a group called wheel, add iwuser to it, and modify the sudoers list to include wheel. Then I use visudo to add wheel to the groups allowed to issue sudo commands. Note the % as a prefix when adding a group to the sudoers list. Finally, I add iwuser to the wheel group.

root# groupadd wheel
root# visudo
root     ALL=(ALL) ALL
%wheel   ALL=(ALL) ALL
root# adduser iwuser wheel

Now, iwuser is able to issue sudo commands. Now I am ready to remove root ssh access by changing a line the configuration file and restarting the ssh service.

root# exit
sudo vi /etc/ssh/sshd_config
PermitRootLogin no
sudo /etc/init.d/ssh restart