kdmurray.blog

The crossroads of life and tech

Ubuntu School – Creating a New User

There are two built-in commands for creating a user from the command-line in Ubuntu: useradd and adduser. useradd is the older command which has, for the most part, been deprecated in favour of the more user-friendly adduser command. Both will allow you to create new user accounts, set up home directories and generally move in the right direction, but adduser will prompt you for information you didn’t include whereas useradd will assume you didn’t want those things (ie create the home directory).

sudo adduser theboss

will produce an output similar to

Adding user theboss' ... Adding new grouptheboss' (1001) ... Adding new user theboss' (1001) with grouptheboss' ... Creating home directory /home/theboss' ... Copying files from/etc/skel' ... Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Changing the user information for theboss Enter the new value, or press ENTER for the default Full Name []: Joe Bossman Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n] y

And there you are! Happy user-creating!

Moving? Redirect with htaccess and 301

Image Credit: Shannon K on Flickr

Image Credit: Shannon K on Flickr

If you’ve ever moved your site from one server to another, or changed domain names you know how difficult it can be to redirect all your old traffic to the new location. Here’s a quick trick to make the transition totally seamless.

Redirect 301 / http://kdmurray.net/

This will redirect every URL beneath the root (” / “) to it’s corresponding URL at mynewsite.net. So if you had a blog post from a couple of years ago that you migrated to the new domain, you can redirect the old URLs (which may have been cached in a search engine) to the new site to drive all that traffic to where it should be going.

In addition the 301 code (see HTTP 301) will tell web browsers & search engines that the page has been permanently moved which will help to ensure that the old site is no longer cached.

This should work with Apache on both Linux (OS X, unix etc.) and Windows.