Disable autologin in Ubuntu

After installing Ubuntu on a stick the system will let you in without asking for a password. What happens is that the display manager LightDM will auto-login the built-in ubuntu user.

While for many people it may seems convenient and fast I would like to have the system protected by a password. If you think like me then please keep reading to find out how to do it. It took me a lot of trials and errors and even if it is not a perfect solution it works for me.

My first idea was to disable the auto-login for ubuntu user and set a password which I had to type in order to log in. This did not work – for some reason the password kept resetting between the restarts and although I had to type the username (ubuntu) I was able to just press the Enter key and log in.

At the end I did the following:

Step 1)
Set a password for the root account:

sudo passwd root

You have to type the password twice. I know it is not recomended but this is my system and I want it that way.

Step 2) Create a new user that you would use most of the times. I will call it joe for example. The best way to create it is to cick the gear icon in the top right corner of the screen and then choose System Settings… -> User Accounts. The click the plus sign (lower left). In the new dialog choose the account type – Standard or Administrator. Type the Full Name and Username. When ready click the Add button.

We have to set a password for this accound and to add it to the sudo group. Open a terminal and type:

sudo passwd joe

You have to type the password twice.

sudo usermod -a -G sudo joe

Step 3) Disable autologin for ubuntu account and enable the manual login

The configuration file that we have to edit is /etc/lightdm/lightdm.conf and initially should look like this:

Screenshot from 2014-12-05 22:41:34

Open the file in your favourite text editor and add the following line to enable the manual login:

greeter-show-manual-login=true

You also need to comment out the autologin-user=ubuntu line by inserting the # sign in the front. Your configuration files should look like this:

Screenshot from 2014-12-06 22:15:08

Step 4) Lock the ubuntu account

Open a terminal and type:

sudo passwd -l ubuntu

The account will be locked and you cannot use it to login. This means we have two accounts we can use to log in – root and joe.

By default LightDM only shows the user-created accounts on the login page. When you restart the system you will see the user joe which you can click on and type the password in order to login. In addition to that you should see the text Login. If you click it you will be able to type a username, press Enter and then type the password. You can use this way to log in with the root user.

In both cases you are protected by a password. I hope this helps you.

OpenVPN client in Ubuntu

I wanted to connect to an OpenVPN server from my Ubuntu on a stick.

There are different clients but the one I liked was the Linux Network-Manager GUI for OpenVPN. To install it you need to enable the Universe repository first:

sudo add-apt-repository universe

sudo apt-get update

and then type:

sudo apt-get install network-manager-openvpn

After the installation completes add a VPN connection by clicking on the wireless icon from the top menu and selecting VPN Connections -> Configure VPN. The network connections dialog pops up:

network connections

Click the Add button and from the drop-down either select OpenVPN or Import a saved VPN connection… and then click Create button:

connection type

In the first case you have to manually configure everything like the location of the user certificate, the private key, etc.

The second option allows you to import an existing configuration file that already have all these settings defined. What I did was to put the configuration file with all the files referenced by it in one folder and import the configuration file.

You can also configure the existing network connections (both wired and Wi-Fi) to automatically connect to your VPN. This is done in the General tab.

Bluetooth headset in Ubuntu

After I installed Ubuntu 14.04.1 LTS I found that the Bluetooth drivers and utilities were already installed. I paired my Bluetooth headset Jabra BT620s without any problems. Unfortunately I could not make it to be the default device for playback or this was what I was trying to do similarly to the way you would do it in Windows. No matter what I was doing the sound kept coming from the computer’s speakers.

It took reading a lot of posts talking about other peoples problems with Bluetooth headsets and their solutions. I tried several of them and what worked for me was installing PulseAudio Volume Control from Software Center:

software-center

It allows you to specify the profile for your headset which by default is off. I set it to High Fidelity Playback (A2DP):

volume-control

The last step is in sound settings to set the mode for the headset to match the profile you chose in the PulseAudio Volume Control:

sound-settings

That was all – no messing with configuration files or running commands in a terminal. I hope these steps work for you too.

Ubuntu on a stick – Installation

This is the first in a series of blog posts that talk about running Ubuntu from a USB flash drive.

Ubuntu (/u:’bu:ntu:/ oo-BOON-too) is a Debian-based Linux operating system. For more information about the operating system itself, please check Ubuntu (operating system) on Wikipedia.

Now that you know what Ubuntu is you may still wonder why anyone would like to run it from a USB flash drive. How about having a free full feature GUI operating system that comes with tons of free tools and applications that you can carry with you and run on any computer that has a USB port without the need to install anything? And it will even run on this 10-year old computer in your basement and will recognize all your devices and will install all the necessary drivers automatically. Not convinced yet? Well, I respect your right to do whatever you want with your time – go check what your friends are doing on Facebook or waste couple of hours on Minecraft. If on the other hand you are curious or stubborn enough to keep reading I will show you how to install Ubuntu on USB flash drive in few easy steps.

I will be doing this from Windows. I have 8GB USB flash drive and part of it will be used to host Ubuntu and the rest will be used for sharing files. In order to achieve this I need to partition the USB drive first. In Windows I use EaseUS Partition Master. Download it from here.

Install and run EaseUS Partition Master with the USB plugged in. We are going to create 3 partitions.

Partition 1
Type: Logical
File System: FAT32
Size: 2GB
Label: STORAGE
Partition 2
Type: Primary
File System: FAT32
Size: 1GB
Label: UBUNTULIVE
Partition 3
Type: Primary
File System: EXT2
Size: 4.22GB (The rest of the space)
Label: casper-rw

Press the “Apply” button to re-partition the USB drive. You should see something similar:

p01

The first partition will be used for file sharing. It is FAT32 because this is the file system that most of the operating systems can read. You can use it under Windows and Linux. If you need more space you can make it bigger at the expense of the last partition (casper-rw).

The second partition is where we are going to install UBUNTU. 1GB is a perfect size. It has to be FAT32 and Primary. Make sure it is set to Active. Since Windows will only show one partition for a removable USB flash drive we need this partition setup as described in order to be accessible in Windows.

The third partition will be used to store any changes we make to Ubuntu – installing new applications, changing the desktop image, etc. EXT2 is a good choice for a file system when it comes to USB flash drive. EXT3 and EXT4 are newer and have some advantages but also come with excessive disk operations which is not desirable for a USB flash.

Now you need to download the Ubuntu ISO file. We want the desktop version. I am using the 64-bit but you should make sure your computer is 64-bit. Otherwise get the 32-bit version. At the time of writing this the latest available version is Ubuntu 14.04.1 LTS.

The next step is to install UBUNTU on the USB. There are several tools to do that and I had different results in the past. One that work well for me is Universal USB Installer. Download it.

Run the installer and on the selections page select Ubuntu from the drop-down, browse to the location you saved the ISO file and select the USB Flash Drive from the drop-down. Also use the slider to specify the Persistent file size. Do not slide it all the way to the right because it will complain there is no enough space. Just put the slider in the middle – the size of the file is not important since we are not going to use it at all. We are doing it just to make the installer to update some configuration files that tell the system to persist the changes. We will be using the third partition we created to persist all the changes we are making to our system:

p02

Leave the installer to run and be patient. When it is ready you should see a message like this:

p03

Click the “Close” button to finish. Go to the USB in file explorer and delete a file called casper-rw. This is the file that would keep all the changes normally. Since we have a dedicated partition we do not need it and have to delete it.

The last step will be to hide the UBUNTU partition and instead make the STORAGE partition the active one. Run the EaseUS Partition Master and make the STORAGE partition Primary and set it to Active:

p04

As a result you will see a new drive labeled STORAGE in windows explorer which you can use to for storing files – music, pictures, etc.

Now it is time to boot from the USB. Depending on the computer you have you might have to change the boot order in your BIOS or if it supports a boot menu you can select the USB drive directly from there. Once the GUI loads try to change the desktop background and reboot again. You should see the new background you selected which confirms that the changes we make to the system are persisted between restarting the computer.

This is it! Hopefully it works for you. If you have any problems, please go back and make sure you followed all the steps. If you still have questions, please do not hesitate to ask.

Keep in mind that in general Ubuntu will run much slower from a USB flash drive than from a regular hard-drive. What the USB gives us is a system we can take with us and run on another computer. If you have a dedicated computer on which you would like to run Ubuntu it is much better to install it on your hard-drive. A good information on how to run Ubuntu alongside Windows can be found here:

WindowsDualBoot