Thursday, November 29, 2007

Passwordless Login For SSH

I've recently set-up a new backup server, I wanted to be able to automate backups from my workstations to the server. I will be using OpenSSH (scp) as the transfer agent between the workstations and the server. By default the OpenSSH server asks for a password every time you login, therefore automation is impossible, without a bit of tweaking.

Creating an environment where passwords are unnecessary can be achieved using public-key cryptography. In this process we create unique identification between workstation (or other system) and server. The server can then recognise the user using a private/public key pair.

There are a number of steps that need to be completed, on both workstation and server, to achieve password-less logins. I have written the required server commands within the `ssh' command, to simplify the process. You will need to have a working OpenSSH server, and user login before beginning.

1. On the Workstation
On the workstation I login as the user who needs the ssh access to the server (this is really important as we are creating a key for this user.) If more than one user needs access, you will need to create keys for each user and system.

If no .ssh directory exists in users home you'll need to create one:
# mkdir ~/.ssh
# chmod 700 ~/.ssh
Now change directory into .ssh and create your ssh key (If you would like to use dsa encryption instead of rsa please use `ssh-keygen -t dsa' in the ssh-keygen command).
This text
, is used to represent your user input:
# cd ~/.ssh
# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/username/.ssh/id_rsa): Press [Enter]
Enter passphrase (empty for no passphrase): Press [Enter]
Enter same passphrase again: Press [Enter]
Your identification has been saved in /home/username/.ssh/id_rsa.
Your public key has been saved in /home/username/.ssh/id_rsa.pub.
The key fingerprint is:
f3:12:g5:23:1f:b2:f7:a0:65:b1:89:72:82:f2:23:g0 username@ssh.server.tld

*Note: If you decide to use a passphrase when creating your ssh key then you will be prompted to enter your passphrase every time you login, unless you use ssh-agent. For more information please see: ssh-agent(1), http://upc.lbl.gov/docs/user/sshagent.html

2. On the server
Now we need to go to the server and prepare the environment for ssh-keys. You will need to login to the server as the user who needs the ssh access. E.g. If I login as the user kris on my workstation I need to be user kris on the server, as well (If you have a different user names on the server and workstation please see note A at the bottom of the post.)
We are going to use one command string to complete all of the jobs on the server, before being prompted for a password:
# ssh username@ssh.server.tld \
'mkdir ~/.ssh; \
chmod 0700 ~/.ssh'
Password: * * * * * *

3. On the Workstation
Now we need to copy the .pub key from our workstation to the server.
# scp ~/.ssh/id_rsa.pub username@ssh.server.tld:.ssh/MY_keys
Password: * * * * * *
id_rsa.pub 100% 397 0.4KB/s 00:00
# ssh-add
Identity added: /home/kris/.ssh/id_rsa (/home/kris/.ssh/id_rsa)

4. On the server
Now we just need to verify the file copied over, and then put it's contents in the .ssh/authorized_keys file:
# ssh username@ssh.server.tld \
'cat ~/.ssh/MY_keys >> ~/.ssh/authorized_keys; \
chmod 600 ~/.ssh/authorized_keys; \
ls ~/.ssh/'
Password: * * * * * *
My_keys authorized_keys

5. On the Workstation
Now if you go back to your workstation you should be able to login to the server without typing your password:
# ssh username@ssh.server.tldor# ssh ssh.server.tld
Notes:
Note A. If you have differing user names on the server and workstation there is an easy solution:
After creating your ssh-key (# ssh-keygen -t rsa), edit the resulting id_rsa.pub (or id_dsa.pub) file and change the user name to the user name on the server.
E.g. If I have a user kris on my workstation and a user sirk on my server I would edit the id_rsa.pub file on the workstation from this:
ssh-rsa Asdasdasdc9asdaDp5Lq8+SMdZRPzgjr65i4684xbmtrZKMQ== kris@workstation.domain.tldto this:ssh-rsa Asdasdasdc9asdaDp5Lq8+SMdZRPzgjr65i4684xbmtrZKMQ== sirk@workstation.domain.tld
Note B. If you do not have a fully qualified domain name or an /etc/hosts file detailing your workstations, and servers IP addresses, you may also need to change the domain name used in your id_rsa.pub file to a IP address.
E.g. from this:
ssh-rsa Asdasdasdc9asdaDp5Lq8+SMdZRPzgjr65i4684xbmtrZKMQ== kris@workstation.domain.tldto this:ssh-rsa Asdasdasdc9asdaDp5Lq8+SMdZRPzgjr65i4684xbmtrZKMQ== kris@192.168.0.3
Note C. If you had another server running the OpenSSH server and you wanted to login from the same workstation using the new key, just copy your id_rsa.pub (or id_dsa.pub) to each server, like in the example above, making sure to copy the contents of MY_keys to ~/.ssh/authorized_keys.

Saturday, November 17, 2007

Hacker Puzzle

A quick weekend distraction, this puzzle is called the: Hacker Puzzle! To solve this puzzle you have to find secret files on the server, by following a trail of numbers ;-).
It only takes a couple of minutes and it's a bit of fun. Check it out at: Hacker Puzzle!
Have an awesome weekend!

Thursday, November 15, 2007

OpenOffice EasterEggs

I thought I'd share a minor distraction with you, did you know that there are a number of Easter Eggs inside of OpenOffice?

"An Easter Egg is the name given to hidden exploits, media, or features available in console and PC video games, DVDs, or any other interactive media."
http://en.wikipedia.org/wiki/Easter_Egg
The following is from the OpenOffice Wiki.

ALL
There are a number of different parts of OpenOffice, Word processor, Spreadsheet, Database, this first Easter Eggs works in all parts of OpenOffice:
In the About box (Help -> About OpenOffice.org) press Ctrl + S, D, T one after another (SDT stands for Star Division Team).
The list of contributors scrolls in the dialog.

OpenOffice Word Processor
The next one is in OpenOffices Word Processor:
Open a New text Document and Enter the word "StarWriterTeam", then press F3.
The names and picture of the StarWriter developer team appears.

OpenOffice SpreadSheet
These Easter Eggs can be found in the Spreadsheet part of OpenOffice.

Games()
Putting '=GAME()' (without the ' ') into any cell results the text "say what?" in that cell.

Frogger
Putting '=GAME("Froggie")' into any cell results the text "Froggie" in that cell.

Tic-Tac-Toe
Put the '=GAME(A2:C4;"TicTacToe")' formula into A1 and press ENTER.
A version of the Tic-Tac-Toe game is playable.

Space Invaders
Put =GAME("StarWars") into any cell and press ENTER. A version of Space Invaders is playable.
Although if you try to play it again, the message "oh no, not again" appears. To play again, you must fully close OpenOffice.org.

Life, Universe and Everything
Put =ANTWORT("Das Leben, das Universum und der ganze Rest") into any cell and press ENTER.
The result is the famous number 42 from the Hitchhiker's Guide to the Galaxy.

StarCalc team
Put =STARCALCTEAM() into any cell and press ENTER.
The names and picture of the StarCalc developer team appears.

Random smileys
Put =TTT() into any cell and press ENTER.
A random smiley appears. E.g. :-] ;-] B-) 8-}

Have Fun!!!

Monday, November 12, 2007

Blogger Tag Cloud

On both my blogs: Geekybits³ and Tea and Turtles I've added a Tag Cloud.
A Tag Cloud is a visual depiction of tags/labels used on a website or blog. The Tags are listed alphabetically, and the frequency is shown using font size and/or colour.

I think that they look very nice, and they also add functionality to your blog. Giving people even more options when navigating around blogs.

Setting up a Tag cloud is really easy, I followed the instructions found here: Setup and configuration for New Blogger Tag Cloud.
The instructions are easy to follow, so if you would like to enhance your Blogger blog with a tag cloud take a look.

Friday, November 09, 2007

Installing New Usplash Themes in Ubuntu 7.10

There are many different looks you can give to your boot screen by adding more themes to usplash, the program which displays the splash image at boot time. You can install a number of them using Synaptic by doing a search for usplash. You can also download different themes online (see below).

Installing StartUp-Manager
Before playing with Usplash themes we need a way to easily switch between themes, enter StartUp-Manager, this program lets us control many aspects of Ubuntu's start-up including Usplash. You can install startupmanager via Synaptic or apt using the following line:
# sudo apt-get install startupmanager

Download Uspash theme
When I searched Gnome-look for Usplash I found a number of very nice themes: Usplash Themes at Gnome-Look. I quite like the Black Chrome theme. Once you have chosen one or two that you like, download them, and extract them from there archive: Right click on the archive .tar.gz and select Extract Here:

Installing Usplash Themes

  • Now we will run the StartUp-Manager to install and change usplash: System --> Administration --> StartUp-Manager
  • Go to the Appearance Tab at the top of the page, and click the Manage Usplash Themes button at the very bottom of the dialogue.
  • Now click the Add button and navigate to where you extracted your files, and select them, (They should be .so files).
  • Your new theme/s should now appear in the Themes list:
  • Close the Manage themes dialogue box.
Selecting your Usplash Theme
  • Once you have installed your themes they should appear in the scroll box under Usplash Themes in the Appearance Tab.
  • Select the theme you would like from the scroll box, just click on it and select.
  • Before you close the StartUp-Manager, check that the settings in the Boot Options Tab under Display are correct for your monitor. I had to change mine to Resolution: 1024x768, and Color Depth: 24 bits.
  • Once you have closed the StartUp-Manager wait until the post configuration has finished:When you shutdown and restart your computer you will be about to see the result, play around with a few different themes and see what you like, Have fun :-)

Wednesday, November 07, 2007

Installing Fonts in Ubuntu 7.10

Installing fonts in Ubuntu 7.10 (Gutsy Gibbon) can be done in a number of ways. Personally I like the following method, it's quick,simple and it works.

Installing some common fonts.
There are a number of very common fonts, which you can install through APT/Synaptic, including the Microsoft TrueType core fonts (e.g. Arial Black, Times New Roman).
Before installing, make sure you enable the extra repositories, (If your not sure how to do this please see: Repositories/Ubuntu).
Install the fonts:
# sudo apt-get install msttcorefonts texlive-fonts-extra
Installing Other fonts
You can also use many other fonts, like those downloaded from dafont.com. There are two options when installing: one to install them for a Single User, this means that only this user can use them, or installing them for System Wide use, so that every user on the system can use the fonts.

Single User:
Once you have downloaded and unpacked your font files (.ttf, .TTF), you will need to create a ~/.fonts if it doesn't exist.
$ mkdir ~/.fonts
Copy the font files to the .font directory:
$ cp *.ttf ~/.fonts
$ cp *.TTF ~/.fonts

Now we need tell the system about the new fonts:
$ fc-cache -f -v ~/.fonts
System Wide:
Once you have downloaded and unpacked your font files (.ttf, .TTF), we just need to move them to the font directory:
# sudo cp *.ttf /usr/local/share/fonts/
# sudo cp *.TTF /usr/local/share/fonts/

Run the following command to rebuild the font cache:
# sudo fc-cache -f -v

Monday, November 05, 2007

Playing With Themes in Ubuntu 7.10

In July I wrote a post which has been quite popular called: Turning Ubuntu's Brown Eyes Blue. This post was about changing themes in Ubuntu, getting away from the orange and brown colours and using mostly blue. Things have changed quite a bit since July and changing themes in the new Ubuntu 7.10 (Gutsy Gibbon) is a little bit different, therefore I thought I would offer some fresh advice.
Doing a search in Synaptic for themes, icons, gdm, or wallpapers reveals that there are many options we could choose from. I thought I would talk about a couple of different ones and let you decide.

Adding Gnome Extras
There are a number of extras we can add to Ubuntu, which will change the look, quickly and simply, each of these themes are quite different from the original Human theme.

Extra Themes
The gnome-themes-extras package will give you:

  • The Darklooks theme, which is a dark Clearlooks theme,
  • The Foxtrot theme, which is a tangonized theme with Bluecurve colors,
  • The Dropline Neu! icon theme, and
  • The Gion icon theme.
I really like the Darklooks theme, it's easy on the eyes. You can install these extra themes by marking gnome-themes-extras for install in Synaptic, or run the following command:
# sudo apt-get install gnome-themes-extras
Once the themes are installed you can use them by opening the Appearance dialog; System --> Preferences --> Appearance and selecting them from the dialogue that opens. To select the icons you need to click 'Customize' and in the 'Icons' tab select them.
Experiment and see which ones you like. You can always select the Human theme, giving you back your original theme, if your unhappy with the choices.

Extra Icons
Installing the extra icons will install heaps of new icons and place them in the /usr/share/pixmaps folder, for use with any program. You can install them by running the following command:
# sudo apt-get install gnome-extra-icons

Extras GDM
If you would like to give your login window a new look you can install gdm-themes, which will give you a variety of different gdm themes (Gnome Display Manager: login Window). To install them run the following command:
# sudo apt-get install gdm-themes
  • To select a new gdm theme open the Login Window dialogue; System --> Administration --> Login Window
  • In the Local tab at the top of the page, select which ever gdm theme you like (Make sure that the radio button is on.)
  • Now close the dialogue.
Once you logout, you should see your new login window.

Giving Ubuntu the Blubuntu look
If you like a blue look you can install the blubuntu-theme by running the following command:
# sudo apt-get install blubuntu-theme blubuntu-gdm-theme blubuntu-wallpapers blubuntu-session-splashes

Selecting the new gnome Blubuntu theme
  • Once it's installed you will need to open the Appearance dialogue; System --> Preferences --> Appearance
  • Then click the 'Customize' button.
  • From the Controls tab select Blubuntu
  • From the Window Border tab select Blubuntu
  • Select an icon set that you like, I chose Mist.
  • Then close the customize dialogue
  • In the Appearance Preferences dialogue you will see a new theme called: Custom (written in italics)
  • Click the 'Save As' button at the bottom and Name your new theme Blubuntu.
Now you have the Blubuntu gnome theme.

Blubuntu GDM theme
  • To select the Blubuntu gdm theme open the Login Window dialogue; System --> Administration --> Login Window
  • In the Local tab at the top of the page, select the Blubuntu gdm theme (Make sure that the radio button is on.)
  • Now close the dialogue.
Once you logout you will see the new gdm theme.

Blubuntu Wallpaper
  • To change the Background image, right click on the desktop and select 'Change Desktop Background'
  • Select the Blubuntu Background (the name appears when you hover over the images with your mouse)
  • Now click close.
The Wallpaper will change straight away.

Blubuntu Splash image
Note: I do not have a splash image on my new Gutsy Desktop, if you have the same situation then the following wont work for you.
To change the splash screen you first need to open a terminal and backup old splash image (if you have one, as I didn't):
# sudo cp /usr/share/pixmaps/splash/ubuntu-splash.png /usr/share/pixmaps/splash/ubuntu-splash.png.bak
# sudo cp /usr/share/pixmaps/splash/ubuntu-slick.png /usr/share/pixmaps/splash/ubuntu-slick.png.bak

Now copy the Blubuntu image into the place of ubuntu-slick.png:
# sudo cp /usr/share/pixmaps/splash/ubuntu-blubuntu.png /usr/share/pixmaps/splash/ubuntu-slick.png
# sudo ln -s /usr/share/pixmaps/splash/ubuntu-slick.png /usr/share/pixmaps/splash/ubuntu-splash.png

Now your entire system should have the Blubuntu look.

Ubuntu Studio Look
If you would like something a little darker the UbuntuStudio theme looks really nice, you can install the theme, and a number of extra components with the following command:
# sudo apt-get install ubuntustudio-theme ubuntustudio-icon-theme ubuntustudio-gdm-theme ubuntustudio-wallpapers usplash-theme-ubuntustudio

Selecting the Ubuntu Studio gnome and icon themes:
- Once it's installed you will need to open the Appearance dialogue; System --> Preferences --> Appearance
- Select the Ubuntu Studio Theme from the Themes Tab.
The system will now change over to the new theme (this could take a minute), using the new icons and all the details found in the install.

Ubuntu Studio GDM theme
  • To select the Ubuntu Studio gdm theme open the Login Window dialogue; System --> Administration --> Login Window
  • In the Local tab at the top of the page, select the Ubuntu Studio gdm theme (Make sure that the radio button is on.)
  • Now close the dialogue.
Once you logout you will see the new gdm theme.

Ubuntu Studio Wallpaper
  • To change the Background image, right click on the desktop and select 'Change Desktop Background'
  • Select the anyone of the newly install Backgrounds (the name appears when you hover over the images with your mouse)
  • Now click close.
The Wallpaper will change straight away.

Ubuntu Studio Usplash
There is no effort involved in getting "Ubuntu studio usplash" working. Once it is installed it should work next time you startup and shutdown. However if you are unhappy with this splash and would like your old Ubuntu one back you need to do the following:
# sudo apt-get remove usplash-theme-ubuntustudio
Once you restart your system you will see the old Ubuntu usplash back in it's place.

Conclusion
Each of these options will give you a totally different look for your Ubuntu Desktop. Many themes have adjustable colour schemes, to give you even more choice. If you're still after something a little different: http://art.gnome.org/ has many more options to choose from, so go check it out, and have some fun with a fresh look.

Saturday, November 03, 2007

Fix for No Splash in Ubuntu 7.10

After installing Ubuntu 7.10 there is no splash screen displayed at startup nor at shutdown. I just get a 'Signal Out of Range' message from my monitor.
A program called usplash controls this process, so I looked into it's configuration, the values were totally off for my monitor, which uses a resolution of: 1024x768.
By default the file looks like:
# Usplash configuration file
xres=1280
yres=1024

I edited the file:
# sudo gedit /etc/usplash.conf
I changed the xres to: xres=1024 and the yres to: yres=768.
Then I reconfigured the usplash program with the new settings:
# sudo dpkg-reconfigure usplash
Problem fixed, now the splash image displays both at startup and shutdown.