2006-08-03

Ignorant -> Newbie: Adding a new user under Ubuntu

Since people seem to have been interested in my posts on choosing a web host, I figured I might as well just document the entire process of getting the VPS set up and made usable. This is the first entry on a (hopefully painless) group of posts on what it takes to get Ubuntu set up and working for running Roundup, Apache, Django, and anything else I want running. I am going to label the posts "Ignorant -> Newbie" in recognition that I will be learning stuff, but will in no way be a Linux admin expert.

All code samples will follow reStructuredText standard of enclosing commands in double backticks. I will also CapCase stuff that is supposed to be filled in by the user.

So, after logging in and running ``apt-get update; apt-get upgrade`` to update the system, I realized I needed a regular user account other than root for running the servers under (I might be ignorant, but I am not *that* ignorant). But how do you create a new user account from the command-line?

Well, it turns out you want ``adduser``. If you run ``adduser -D`` it will list the defaults for the command. Typically, you will want ``adduser -m -s ShellPath Username``. ``-m`` specifies that a home directory is to be created and ``-s`` allows the path specification of the shell.

The next trick is changing the password for the account. There is a ``-p`` option to ``adduser`` that takes in an argument for a password as created by ``crypt``, but that is most for scripting the creation of accounts. An interactive solution is ``passwd Username``. This will prompt for you for the password to use.

As of right now I am planning on using a single account for all servers since it is only me on the "machine". I could create an individual account to run each individual server so that if one gets compromised they all don't get screwed, but since there will not be anything critical on the machine that I can't stand to lose I don't feel the need to go through the hassle of having multiple accounts (I plan on making sure I have the proper backups of files on my laptop since I am going to run everything off of sqlite and thus can rsync the database easily).