Wednesday, February 11, 2015

How to Change Login Background in Ubuntu 12.04

Changing the desktop background is easy and probably everyone has already done it. What about tweaking your machine even further to your liking? What about changing the background of the LOGIN screen? Let's do it!

By default, Ubuntu 12.04 uses the following file as its login background,
/usr/share/backgrounds/warty-final-ubuntu.png

To change this  default background what one can do is to do a backup of this original image and copy your background here with the same name. Probably not the most elegant solution, but it serves its purpose.
  1. Make a backup of the original image
    sudo mv /usr/share/backgrounds/warty-final-ubuntu.png /usr/share/backgrounds/warty-final-ubuntu_backup.png
  2. Copy the image you want to use as background
    sudo cp ~/MyBackground.png /usr/share/backgrounds/warty-final-ubuntu.png
    Where "MyBackground.png" is the image you want to set as login background. Use absolute paths for copying, that is /home/user/......
  3. Reboot or relog to your your system to be welcome by the new login background.

Note:
If you wish to undo the changes or simply use another background picture for the login screen, simply copy back either the original image or the new one you like.

  • The background of your selection must be a *.png file, matching screen size.
  • The name has to be warty-final-ubuntu.png

Saturday, February 7, 2015

Generate Random Passwords Easily

I have added a short function in my ~/.bashrc file that allows me to quickly generate a password of any length containing letters, numbers and symbols. This comes in handy when registering for a new website or similar.

Randomness

 

The command uses /dev/urandom to generate the random string. Evaluating the true randomness and strength of this password is beyond this guide. However, this should be sufficient for any general use.

Step by Step

  1. Edit the .bashrc file to add a new function that can then be called by an alias command.
    nano ~/.bashrc
  2. Add the following lines to the end of the file [1],
    passwdgen()
    {
    tr -dc "a-zA-Z0-9-_!@#$%^&*()_+{}|:<>?=" < /dev/urandom | fold -w $1 | head -n 4
    }
  3. Then add an alias to easily call this function by,
    nano ~/.bash_aliases
  4. Add an alias of your liking.
    alias genpasswd='passwdgen' 
  5. Apply changes by either logging out and back in or,
    sudo source ~/.bashrc

Originally I wanted to call the alias command "passwdgen", however when using TAB to quickly substitute commands this was conflicting with "passwd". Hence I decided to use "genpasswd".

Done. The command can be used as,
genpasswd <password_length>
For example I want a password with 30 characters I would do,

:~$ genpasswd 30
0kA|=yff2RT(LE#|%QVMZVsFq2Tm&|
OPw1x=R9QMt}KhR*Xp?tluvu70+6=M
1-s)%-G19Gucz!fd@!+WXQZQ<U0ZVx
vJg:-Bvx)>>-?1qe_-TvEG8SHnUWXz

Note: You get 4 passwords as an output from the function (head -n 4). This is simply to give a choice for the user to decide which password to use. Also, this adds another increment of randomness.

The list of used symbols can be altered by editing the function contents within the quotes "a-zA-Z0-9-_!@#$%^&*()_+{}|:<>?=". Adding extra symbols will increase the strength of the password, however some website (rarely) have restrictions on what symbols can be used.

Sources