Monday, December 26, 2016

How to use Google services the smart way

As you surely know there are more ways than one to use Google services (mail, chat, blog e.t.c e.t.c.)

Most people nowadays start an Google account when they buy a new phone, mainly for the reason of having Google as their e-mail provider.

Even if the integration of the Google account and services like Gmail, Chrome e.t.c. is almost seamless, there are cases where you actually want them separated.

One example is when you already have an e-mail (and provider) but still want to use the rest of Google services, especially with that email-address as your account. This would be a very common case with your work-email (often hosted by the company itself) and your private one.

One way of doing this is by association. I.e. you bind your work e-mail address to your private Google-account.

Don't do that!

There are many drawbacks with this, the one that bothers me the most is that you in Chrome have to log-out from one to use the other, they easily get mixed up and you cant't separate notifications between the two (i.e. your private life will suffer). Another is that you can't have family members reaching you on hangouts on one "account" (remember it's not an account, it's just an associated email address) while still having your work-chat active and vice versa. And a third one, what happens when you leave your employer? Purging an account is much easier than purging contents in a shared associative one.

Google tries hard to associate addresses instead of permitting multiple real accounts for reasons not clear to me (well maybe except for the shady ones i.e.).

But you can create an un-associated account with the work email-address account-name instead. This is one way you can do it:


  1. Use a normal computer and run Chrome web-browser
  2. Log out from Chrome from the current user. This should take you to a page where you can sign in again AND where there is a link underneath saying Creating New User.
  3. You now have a login-screen up in-front instead. Choose "create new user". Depending on Chrome version/distribution you may not get to the correct log-in screen. You can then try follow this link instead, note while still logged out: Create New User
  4. Create user with the correct name@domain (the same as you use for your daily work email).
  5. Carefully avoid to enter any other e-mail addresses when asked.
  6. Done
Now participating using shared documents should work straight away. But hangouts may not work until you also do a little trick (hangouts doesn't work if you see a the little circle where the chat-list history should be with the text "Things are taking longer than expected.(Errors: 212, 213, 214)" underneeth that never stops changing colours regardless of how long you wait):

While logged into Chrome with your new user-account, go to google-calendar: https://calendar.google.com
There you'll be asked to create a Google calendar account. After that, hangout's "should" (TM) work.

Hint: You can use this in your phone too. Add account under settings and just un-check mail-sync if it's not already, as you don't have Google-hosted email in that name (you just use a string as account-name that is one, but not Google's).

Saturday, December 24, 2016

Experiences from Debian 6 sever meltdown due to physical disk-crash: 1. Getting the services back online (ejabberd)

After long silence, here's finally a new tip. This time it's about ejabberd.

My server running an old Debian 6 burned up. Of-course all /home was backed-up, but who backs up the root-fs? When you're not working with UNIX server administration, that partition represens a valuable investment.

I have had the habit of using git for all config-changes and was relying on that for "backup". Well, it has some draw-backs... I could salvage most of the content of the root-fs, but then again Debian 6 is by now a very old distro suffering from the heart-bleed security-bug among others.

So I figured I'd install Debian 8.6 instead. Surely most of the services should be portable?

Nope, not at all!

Apache2 is version incompatible as is ejabberd. All hours (weeks) spent setting these up blew up in an isntant. All vhosts, all https configs, portals, PEM-configs of various kinds, user-databases e.t.c. POFF!

If you have spent hours and hours to set services up and don't do it very-day (i.e. your not an admin by profession) PLEASE back up your rootfs regularly too.  Make the FS small, 16G should be more than plenty for a server, yet small enough to back-up entirely on your NAS which is nowadays every-mans home (or somewhere else, just do it!).

You may not want to restore to the exact same version as in my case, but at least you can restore temporarily and use the distributions upgrade mechanisms to change change both HW and distro-version. If all works as it should it will save you lots of time, weeks in my case. Broken rootfs:es usually have the tendency of not being able to run. If not only the fs is broken but the whole disk is (even if just partly), then you might as well forget about any repairs that will either maintain data nor enable you to quick-upgrade.

So back to the pain-staking reconfiguration!

Ejabberd turned out to be fairly salvageable though.  From the partly recovered rootfs:

find . -type d -iname "ejabbe*"

Stop the destinations ejabberd server:

ejabberdctl stop

Then copy relevant directories into the new host. Make sure to check permissions (at least user:group) of the destination before copying to be able to correct them on destination.

scp -r ./etc/ejabberd/ root@FQDN:/etc/
scp -r ./var/lib/ejabberd root@FQDN:/var/lib/
scp -r ./var/log/ejabberd/ root@FQDN:/var/log/

scp -r ./usr/share/ejabberd root@FQDN:/usr/share
scp -r ./usr/share/doc/ejabberd root@FQDN:/usr/share/doc/

The last two you can/should probably omit. The first one obviously not, but the second is not so obvious. It's where ejabberd keeps it's database.

That actually worked almost painlessly. It turned out that ejabberd config-format had changed and and is now also in another file (etc/ejabberd/ejabberd.cfg -> etc/ejabberd/ejabberd.yml).

Open both files, read carefully for each setting and copy-paste & reformat setting.

When done, give it a try but inspect

tail -f /var/log/ejabberd/ejabberd.log
ejabberdctl start

And voila: server is up. Users are there, PEM seems to work and perhaps most importantly: all the friend-connections!

Lesson learned though: Back up your rootfs properly too! This time (and with this service) it was just dumb-luck.

(If you want to chat with me over XMPP/jabber, you can hence now do so again: michael@ambrus.se)