kdmurray.blog

Personal Weblog of Keith Murray

kdmurray.blog - Personal Weblog of Keith Murray

Ubuntu School – Get Rolling with Webmin on Ubuntu Server 11.10

Even if some Linux purists would have you believe the command-line is the only way to go, the pragmatist in me will always take an appropriate GUI over a complicated command-line any day. You can run a lot of powerful services for your home network using one or more Ubuntu server machines. With the right tools you don’t need to be a Linux expert to make that happen.

The tool of choice is Webmin. This is a set of web-based tools which allow you to control virtually every piece of server-side software on you Ubuntu server. The GUI is intuitive and straight-forward, the documentation is excellent, and the project is under active development.

Because Webmin isn’t in the standard repositories you will have to do a couple of quick command-line changes to configure your system to be able to find and download the apt package.

sudo nano /etc/apt/sources.list

Once the file is open, add these lines to the bottom of the file

#########################

Package Sources for Webmin

deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib

Those lines will add the necessary sources to apt for it to find the Webmin package. The Webmin package has also been digitally signed by its author. By default you will need to download the author’s key so that apt can use it to verify the Webmin package at install time. Fortunately, this is really easy to do.

wget http://webmin.com/jcameron-key.asc
sudo apt-key add jcameron-key.asc

Now that all the prep work is done, it’s time to install Webmin.

sudo apt-get update
sudo apt-get install webmin

All done! Now you can access administrative functions of your server’s services from the Webmin console: https://yourservername:10000/. This URL is also shown in the last few lines of the apt install details that are ouput to the command-line.

Running Shell Scripts from the Finder in OS X

Bad AppleOne of the things that drives me insane about the Mac on occasion is the ability of OS X to make some of the simplest “power-user” tasks very difficult. Case in point – the ability to execute a shell script from a finder window (or by extension, the desktop).

In most sane operating systems, including Linux and Windows, if you double-click on an executable file, it executes. It’s just that simple. If you create a batch file on Windows (anything ending in .bat or .cmd), the operating system treats that file type as executable and will try to run the contents as command-line commands. In Linux, an operating system which is similar under the hood to OS X, you need to set the “executable” bit in the permissions. This is certainly more of a super-user type task than simply renaming the file, but still quite simple — and consistent across the POSIX world… except for Apple.

chmod +x myscript.sh

So the question is, how do I do this on my Mac? The answer I’ve been given by several people until today was that you would need to use AppleScript or Automator (or Xcode) to create a program that could be run from the Mac GUI. As ludicrous as it seemed, Apple’s tendency to force users to do things the “Apple way” made that quite believable. However I found a post today on Adam Young’s blog from back in 2008 which showed that it is, in fact, possible to do this — it’s just a bit harder than on any other OS. Essentially you have to do both the Linux (chmod) step, and the Windows (specific file extension) step.

mv myscript.sh myscript.command
chmod +x myscript.command

You need to use the .command extension for the Finder to actually attempt to run your shell script. An identical file with the execute bit set but with a .sh extension will simply open up in Xcode (or whatever editor you have set for .sh files).

Siri Cheat Sheets

Right after I picked up my iPhone 4s late last year I found myself wondering if there was a list of valid “commands” for Siri. Since it’s supposed to provide “natural language” support, I was really looking for a comprehensive list of the things that Siri was supposed to be able to do for me.

I found a link to a blogger who has collected together a nice cheat-sheet of Siri commands. Available in both PDF and DOCX formats.

While I haven’t tried everything Siri can do (I live in Canada after all), I’ve tried a lot of them, and everything that “should” work, does work.

Ubuntu School – Add an Existing User to a Group

Occasionally you need to grant an existing user some additional permissions to files, directories or applications. This typically means some kind of change in your permissions settings for the object in question. But because you can only have a single owner for a given object you need to be careful making these changes.

Something you can do, though, is extend the permissions on the object to a set of users by way of a group. Logically, a group is nothing more than a named collection of users who all have the same access (by way of that group) to some resource. Users in Ubuntu typically carry one primary, and one or more secondary groups (I won’t get into the differences here).

By adding group permissions to your resources (ie give the ‘payroll’ group read/write access to the ‘HR’ folder) you can simply add users to and remove users from the appropriate groups and be confident that their level of access to the resources on your machine is set correctly.

To add an existing user to an existing group:

sudo usermod -a -G payroll graymond

To remove a user from a group you use the same command. The catch is, you remove a user from a group by re-adding all of their groups and simply omitting the group you wish to remove them from.

sudo usermod -nG mkirkpatrick

The system will show you a list of the user’s groups.

marketing sales vanprinters torprinters

Then you simply run the usermod command as above, removing the group in question (in this case vanprinters)

usermod -G marketing,sales,torprinters mkirkpatrick

Email Consolidation with Gmail

What is it

This article was inspired by an episode of the Mac Power Users podcast talking about strategies to manage email. With those tips in mind I set about carving out an email strategy that would help me get my multitude of email accounts down to a reasonably dull roar.

The concept is simple. The fewer mailboxes you have to check, the simpler checking email becomes. It can also be easier to answer the question “what’s your email address” when you don’t have so many to choose from.

This is admittedly a problem that only a relatively small subset of people will have. There are always going to be people out there who only have a single email address and who would never need to read through this article because one is about as consolidated as you can get.

This series will get into a fair bit of detail on what features of Google’s email service best serve these needs, and how you can put these things to work for you.

Why would I do this?!

To illustrate, a parable:

Bill was a busy man. He would spend his time every Saturday going from bank to bank moving money and paying bills. He had accounts at many different banks. His reasons were as varied as the banks and the accounts themselves, but each of them had add perfect sense at the time.

He had a chequing account with a bank that was partnered with his employer, that’s where his pay was deposited. He had a savings account with a bank he’d been with since he had his first job 15 years ago. He had a joint account with his wife at another bank which was partnered with her employer (where her pay was deposited) and an account with another bank that held his mortgage. While each individual account was in and of itself a good idea, and seemed wise at the time, all of Bill’s Saturdays were sing consumed with trying to manage and move money between his various institutions.

Bill could save a lot of time and energy by replacing some or all of these accounts with single account. In short, consolidate. By having his pay and his wife’s pay deposited into the account that their mortgage is drawn from it would greatly reduce the complexity of his life – and might even open up a few hours on Saturday to do something more important.

That story should sere to illustrate my point, but in case it wasn’t clear, let me be blunt. Shutdown and if necessary re=point your old email addresses to a new single collection point. Instead of bouncing around between who-knows-how-many different email inboxes, you can manage everything from Gmail or from one of the client solutions that ties into Gmail’s IMAP services.

It sounds like a lot of work

It is. I won’t sugar-coat the truth by pretending this is something you’ll get done in 10–15 minutes. You won’t. If you’re still interested, Here’s how I went about it:

1. Identify accounts to kill

The first step in the process is to figure out just what needs to be cut. Be ruthless. Any account that receives way too much spam should be considered to go on this list. Another good set of candidate accounts is those that only allow POP access. Many ISP accounts, and some free email accounts are set up like this. If you can eliminate your dependence on your ISP’s email account, you will eliminate a major barrier to leaving that ISP if you need to down the road.

2. Identify accounts to keep

If you already have a Gmail account it may be at the top of your to-keep list – assuming of course it’s not the one you’ve been using to sign up for every shiny new cloud service, I which case you may need to dump it. I also recommend keeping any important email addresses that you have, even if you don’t use the email service. I have an address from school which is useful for getting some student discounts. I’ll talk about how to handle this later.

Finally there’s the question of what to do with work and personal email. As far as I’m concerned the only thing to do is keep them separate. This is one case where mixing work and pleasure is not a good thing.

3. Identify accounts to create

This is a place to give some thought. If the stuff you’re keeping doesn’t fully fit the bill for the addresses you need you may need to create one or two. If you have your own domain, you may want to consolidate down to have your email addresses live there. This can add a sense of personality or style to the email addresses you use.

4. Map old to new

Decide which old addresses that you’re keeping need to flow into which of the mailboxes you’re keeping. This is an important distinction – you don’t have to keep the actual mailboxes for each of the addresses you want. For new addresses that are aliases, you may be able to do this from your domain hosting provider’s admin panel. For addresses that were formerly mailboxes you had been using it will involve some trickery. This is a step that helps to have some visual aids.

5. Import messages

In each of the new Gmail accounts that will be receiving messages from old addresses you need to setup mail import from the existing account using POP.

  1. Open your Gmail settings
  2. Select Accounts and Import
  3. In the section Check mail using POP3 click Add a POP3 account that you own
  4. Follow the prompts to configure that account

6. Forward old email accounts

If your email provider for the old account supports email forwarding you can set that up instead of using up one of your POP mail slots.

7. Tell your friends!

Once all of the configuration is done, you need to tell people about your shiny new address(es). Send emails out to all of your contacts who need to have your new addresses. Send these messages from the new accounts so that people who reply to the messages will already be using the new ones. And don’t forget to BCC everyone, please.

Ubuntu School – sudo Your Last Command

Sometimes we just forget that we need to specify elevated privileges on our Ubuntu machines. I do it all the time, particularly when I’m setting up a new machine.

Thankfully there’s a shortcut for those of us who are forgetful. If I want to restart the box I can use a command like:

shutdown -r now

But of course that command requires elevated privileges:

shutdown: Need to be root

With the fantastic !! argument for sudo you can repeat your last terminal command:

sudo !!

Now you can quickly and efficiently re-run that last command you forgot to sudo!!

Ubuntu School – DHCP Release and Renew

It’s not uncommon to need to release/renew the IP address for a given machine. This is particularly true if you’re doing any kind of maintenance on your network, or are troubleshooting pretty much any kind of Internet problem. I never seem to remember how to do this, so I’m including this post as much for my own benefit as anything.

What I’m talking about is the Ubuntu equivalent of these windows commands
ipconfig /release
ipconfig /renew

From an Ubuntu terminal type:
sudo dhclient -r
sudo dhclient

Much like the Windows equivalents you can also specify these actions for a specific interface if your situation requires.

sudo dhclient eth0

Review – iPod Nano (6th Generation)

iPod Nano (6th gen)I was fortunate enough to come across the program that Apple had put together replacing some units of their 1st generation iPod nano because of a potentially explosive battery issue. Though the process has been lenghty (nearly 3 months), I have finally received my replacement unit: a shiny new 6th generation Nano.

It’s a pretty fantastic upgrade: 2GB – 8GB of storage, touch-screen controls and the ability to turn it into a funky wristwatch are all pretty cool.

Now I need to figure out just where the device fits in as far as my usage patterns. Most of what it does I already do on my iPhone on a daily basis, but I’m sure there’s a good use for a microscopic 8GB media player!

If you have a 1st generation iPod nano, it might be worth checking out the iPod nano replacement program website to see if you are eligible for an upgrade.