Folding@Home

20, December 2009 by wobblybob9

Just decided to give Folding@Home a try, it’s a project which uses the spare processing time of thousands of private users PC’s to process calculations which help scientists study disease and in time cure them. More information can be found on the Folding@Home site. The project is run of the client PC’s using software which can be downloaded from the site for various o/s. The software then downloads sections of work from the project servers, works on the section using your PC’s spare processing time then uploads the results before downloaing another section to work on. As a user you gain points for the work your PC completes which you can then either assign to your own “Team” or join another Team of users. You can then track your personnal/Team results. I have decided to join the Team Ubuntu which has an id of #45104. First you need a user name, check that yours is unique by checking it here.

I have decided to use my server to help this project when it is not processing work for myself. The server is currently running a 32bit version of Ubuntu Jaunty [v 9.04]. I therefore downloaded the 32 bit version of the Floding@Home software from the above site currently at version 6.02 [20/12/09]. I then created a new Directory called Floding@Home in my home Directory and extracted the contents of FAH6.02-Linux.tgz to this Directory.

I then opened a [Terminal] and cd to the new Directory.

~$ cd Folding@Home

Then ran the following;

~/Folding@Home$ sudo ./fah6

This then asks the following questions;

User name [Anonymous]? Type in your username, then press [Enter].

Team Number [0]? Type in the number 45104, then press [Enter].

Passkey []? Leave blank, press [Enter].

Ask before fetching/sending work (no/yes) [no]? to make things automatic, leave at no and press [Enter].

Use proxy (yes/no) [no]? I’m not behind a proxy, so I left at no, and pressed [Enter].

Acceptable size of work assignment and work result packets (bigger units may have large memory demands) — ’small’ is <5MB, ‘normal’ is <10MB, and ‘big’ is >10MB (small/normal/big) [normal]? again I left at the default of normal, and pressed [Enter].

Change advanced options (yes/no) [no]? and again left at default, pressing [Enter]. The program then ran, updated, downloaded the first batch of work and started to process…..

Note: works in Ubuntu Jaunty v9.04.

Quake One

13, December 2009 by wobblybob9

Well it’s been a while since I’ve played this but I finally got it working in Ubuntu Karmic using glquake, the .pak files from my Quake One CD and a script using the info. from this thread at http://forum.eeeuser.com I created a folder called quake_one and within it another called id1, I then copied the .pak files from the CD to the id1 folder making sure their filenames were in lowercase. Then copied the glquake file to the quake_one folder. Now I created a script in my path called quake_one.sh with the following in it;

#!/bin/sh
## Update Permissions
sudo chmod 666 /proc/asound/card0/pcm0p/oss
sudo chmod 666 /proc/asound/card0/pcm0c/oss
echo “Permissions changed…”
## change to quake one directory ##
cd ~/quake_one
## redirect quake sound ##
sudo echo “glquake 0 0 direct” > /proc/asound/card0/pcm0p/oss
sudo echo “glquake 0 0 disable” > /proc/asound/card0/pcm0c/oss
## run quake one prog ##
./glquake

saved it to ~/bin  then made the script executable with;

chmod +x ~/bin/quake_one.sh

Now run quake_one.sh in a [Terminal] or create a launcher pointing to this script, all done.

Shared Directories with Samba

4, October 2009 by wobblybob9

Configuring the Samba conf.file [smb.conf]

First, create a shared folder by opening a [Terminal] and either typing or copy & pasting the following;

martin@linux:~$ sudo mkdir /home/my_share

make it available to all users;

martin@linux:~$ sudo chmod 0777 /home/my_share

install samba with;

martin@linux:~$ sudo apt-get install samba

stop samba running with;

martin@linux:~$ sudo /etc/init.d/samba stop

rename the current config file as a backup template with;

martin@linux:~$ sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.backup

create a new config template;

martin@linux:~$ sudo touch /etc/samba/smb.conf

open new config file with;

martin@linux:~$ sudo gedit /etc/samba/smb.conf

now copy & paste in the details from the smb.conf file here, changing details of network name [my_network], computer name [my_linux_box] and the shared folder details [my_share] as required.

save and close the config file.

start samba again with;

martin@linux:~$ sudo /etc/init.d/samba start

Add yourself as a samba user with;

martin@linux:~$ sudo smbpasswd -L -a my_name

enter your admin password when asked.

martin@linux:~$ sudo smbpasswd -L -e my_name

Shutdown confirmation message

4, October 2009 by wobblybob9

Remove the 60 second to shutdown confirmation message in Karmic Beta.

Open a [Terminal] and type gconf-editor and press [Enter], now using the left-hand menu select [apps], then [indicator-sessions] and tick the box next to [ suppress_logout_restart_shutdown ]

Backup using rsync, SSH & cron

31, August 2009 by wobblybob9

Backup on Ubuntu.

Updated 09/11/09 to correct some errors!

This “How To” was written with the help of this article by Troy Johnson, here and amended were necessary to fit my needs.

I have 2 PC’s on a network and want to backup some files from one PC the [remote_client] to the other PC the [server] to do this I want to run a script from the server. The process can be atcheved using rsync & SSH and automated with a cron job on the server.

Step:1

We install on the server

open-ssh-server and rsync

and on the client openssh-client and rsync

This can be done via the Synaptic Package Manager or using the command line i.e.

~$ sudo apt-get install openssh-client

~$ sudo apt-get install rsync

you also may want to check that cron is installed and if you want a GTK version of rsync you could install gadmin-rsync.

So the files I want to backup are on the remote_client in the following folder; /home/martin/my_files

and I want to back them up on the server in the following folder; /home/martin/backups

Note: I have an account on both PC’s with the same name and password, and read access to both the source & destination folders.

On the server we test out a basic script called backup.sh and saved with the Permissions set to “allow executing as a program”, check out my post here for help with that, the content of the script is;

#!/bin/sh

## first script to copy files from remote_client to server ##

rsync -avz -e ssh martin@remote_client:/home/martin/my_files/ /home/martin/backups

save the script and then run it by typing;

~$ ./backup.sh

in a Terminal assuming you saved the script in your home directory /home/martin and called it backup.sh. You should be prompted for your user password on the remote_client then the process should start.

To make this more secure edit the ‘authorized_keys’ file in servers /home/martin/.ssh folder with a text editor and modify the line with ’server-rsync-key.pub’ information on it from this:

Step:2

Ok so that does the trick but if I’m to automate this script it needs to work without SSH asking me for my password each time. To do this I need to generate a private/public key pair, this is much more secure than adding the actual password in the text of the script or elsewhere linked to it.

We now need to be logged onto the server;

To generate the key pair I open a [Terminal] and issue the command;

~$ mkdir /home/martin/.key

to create a hidden folder in my home folder called .key [the dot makes it hidden], then;

~$ ssh-keygen -t dsa -b 1024 -f /home/martin/.key/server-rsync-key

Generating public/private dsa key pair.

Enter passphrase (empty for no passphrase): [press Enter]

Enter same passphrase again: [press Enter]

Your identification has been saved in /home/martin/.key/server-rsync-key.

Your public key has been saved in /home/martin/.key/server-rsync-key.pub.

The key fingerprint is:

etc. etc.

I now have 2 files in the .key folder in my home folder called;

server-rsync-key

and

server-rsync-key.pub

I now copy the server-rsync-key.pub key over to the remote_client into my home folder /home/martin and log onto the remote_client.

Now on the remote_client, I issue the following command in a [Terminal]

~$ if [ ! -d .ssh ]; then mkdir .ssh ; chmod 700 .ssh ; fi

[this checks to see if the folder .ssh exists and if not creates it]

~$ mv server-rsync-key.pub .ssh/

[this moves the key from my home folder to the .ssh folder, hidden in my home folder]

~$ cd .ssh/

[we now move to the .ssh folder]

~$ if [ ! -f authorized_keys ]; then touch authorized_keys ; chmod 600 authorized_keys ; fi

[this checks to see if there is an authorized_keys file and if not creates it with the correct permissions]

~$ cat server-rsync-key.pub >> authorized_keys

[this copies the contents of server-rsync-key.pub key into the file authorized_keys file.

If we now run our original script with the amendment below on the server it no longer asks for a password.

rsync -avz -e "ssh -i /home/martin/.key/server-rsync-key" martin@remote_client:/home/martin/my_files/ /home/martin/backups

Step:3

Now the key can be used to make connections to the remote_client, but these connections can be from anywhere (that the ssh daemon on remote_client allows connections from) and they can do anything (that remote_user can do), which could be dangerous.  To make this more secure edit the 'authorized_keys' file in remote_client /home/martin/.ssh folder with a text editor and modify the line ending user_name@server_name from this:

ssh-dss
yl6b2/cMmBVWO39lWAjcsKK/zEdJbrOdt/sKsxIK1/ZIvtl92DLlMhci5c4tBjCODey4yjLhApjWgvX9
D5OPp89qhah4zu509uNX7uH58Zw/+m6ZOLHN28mV5KLUl7FTL2KZ583KrcWkUA0Id4ptUa9CAkcqn/gW
kHMptgVwaZKlqZ+QtEa0V2IwUDWS097p3SlLvozw46+ucWxwTJttCHLzUmNN7w1cIv0w/OHh5IGh+wWj
V9pbO0VT3/r2jxkzqksKOYAb5CYzSNRyEwp+NIKrY+aJz7myu4Unn9de4cYsuXoAB6FQ5I8AAAEBAJSm
DndXJCm7G66qdu3ElsLT0Jlz/es9F27r+xrg5pZ5GjfBCRvHNo2DF4YW9MKdUQiv+ILMY8OISduTeu32
nyA7 etc....

to this:

from="10.1.1.1", command="/home/martin/.key/validate-rsync" ssh-dss bA402VuCsOLg
yl6b2/cMmBVWO39lWAjcsKK/zEdJbrOdt/sKsxIK1/ZIvtl92DLlMhci5c4tBjCODey4yjLhApjWgvX9
D5OPp89qhah4zu509uNX7uH58Zw/+m6ZOLHN28mV5KLUl7FTL2KZ583KrcWkUA0Id4ptUa9CAkcqn/gW
kHMptgVwaZKlqZ+QtEa0V2IwUDWS097p3SlLvozw46+ucWxwTJttCHLzUmNN7w1cIv0w/OHh5IGh+wWj
V9pbO0VT3/r2jxkzqksKOYAb5CYzSNRyEwp+NIKrY+aJz7myu4Unn9de4cYsuXoAB6FQ5I8AAAEBAJSm
DndXJCm7G66qdu3ElsLT0Jlz/es9F27r+xrg5pZ5GjfBCRvHNo2DF4YW9MKdUQiv+ILMY8OISduTeu32
nyA7 etc....

where "10.1.1.1" is the IP address of server, and "/home/martin/.key/validate-rsync" point to a script called validate-rsync as follows:

#!/bin/sh
case "$SSH_ORIGINAL_COMMAND" in
*\&*)
echo "Rejected"
;;
*\(*)
echo "Rejected"
;;
*\{*)
echo "Rejected"
;;
*\;*)
echo "Rejected"
;;
*\<*)
echo "Rejected"
;;
*\`*)
echo "Rejected"
;;
*\|*)
echo "Rejected"
;;
rsync\ --server*)
$SSH_ORIGINAL_COMMAND
;;
*)
echo "Rejected"
;;
esac

If server has a variable address, or shares its address (via NAT etc.) with hosts you do not trust, omit the 'from="10.1.1.1",' part of the line (including the comma), but leave the 'command' portion. This way, only the 'rsync' will be possible from connections using this key. Make certain that the 'validate-rsync' script is executable by remote_user on remote_client and test it.

So in my case the result looks like this:

command="/home/martin/.key/validate-rsync" ssh-dss bA402VuCsOLg9YS0NKxugT+o4UuIj
yl6b2/cMmBVWO39lWAjcsKK/zEdJbrOdt/sKsxIK1/ZIvtl92DLlMhci5c4tBjCODey4yjLhApjWgvX9
D5OPp89qhah4zu509uNX7uH58Zw/+m6ZOLHN28mV5KLUl7FTL2KZ583KrcWkUA0Id4ptUa9CAkcqn/gW
kHMptgVwaZKlqZ+QtEa0V2IwUDWS097p3SlLvozw46+ucWxwTJttCHLzUmNN7w1cIv0w/OHh5IGh+wWj
V9pbO0VT3/r2jxkzqksKOYAb5CYzSNRyEwp+NIKrY+aJz7myu4Unn9de4cYsuXoAB6FQ5I8AAAEBAJSm
DndXJCm7G66qdu3ElsLT0Jlz/es9F27r+xrg5pZ5GjfBCRvHNo2DF4YW9MKdUQiv+ILMY8OISduTeu32
nyA7 etc....

Our backup.sh script now looks like this:

#!/bin/sh

## second script to copy files from remote_client to server ##

rsync -avz -e "ssh -i /home/martin/.key/server-rsync-key" martin@remote_client:/home/martin/my_files/ /home/martin/backups

Step:4

I now need to run the script from a Cron job, first move the backup.sh script into your $PATH, for help with this check out my post here.

Now on the server open a [Terminal] and issue the command:

~$ crontab -e

This should open a text editor, normally vi, normally paste into it the following text as a reminder

# leave a space between each option #
# the * is a wildcard option #
# dayofmonth is 1 to 31 #
# dayofweek can be 0 – 6, 0 is Sunday #
# or use mon tue wed etc #
#
# mins hours dayofmonth month dayofweek command
# * * * * * * command

Then use Crontrol+o to save and press [Enter] to save, then Control+x to [Exit].

and test…

Cron jobs

31, August 2009 by wobblybob9

Cron tabs can be used to automate jobs on your system by running programs or scripts at prdefined times, dates or days, each user can have their own cron tabs or they can be run as root. To open a crontab, type the following in a [Terminal];

crontab -e

this will open in the vi text editor, but if you prefere the gedit text editor, run the following command;

export VISUAL=gedit

If you stick with vi then use Control+o followed by [Enter] to save your tab, then Control+x to [Exit].

When you run crontab -e, you will get an empty crontab with just the following [or similar] dispalyed;

# m h dom mon dow command

the headings are described below and I usually add these to the top of the file to make things easier to edit. So my crontab looks like this:

# m h dom mon dow command

# mins -> minutes (0-59)

# hours -> hour (0-24)

# DayOfMonth -> day of month (1-31)

# month -> month (1-12)

# DayOfWeek -> day of week (0-6) [Sunday is 0], or

# DayOfWeek -> day of week (mon – sun)

# You can use ‘,’ ‘-’ to give you 1,2,3,5 or 1-5 etc

# The * is used as a wildcard i.e every month

# m h dom mon dow command

# * * * * * /command

Examples;

each of the 6 command requires a space between them, here are a few examples;

### runs cron 2 mins past every hour ###

2 * * * * /home/martin/bin/play_sound.sh

### runs cron every 2 minutes ###

# m h dom mon dow command

*/2 * * * * /home/martin/bin/play_sound.sh

#01 * * * * root run-parts /etc/cron.hourly

#The run-parts script is simple enough: it just runs all the executables in the specified directory

### runs cron every fri at 15:30 ###

# m h dom mon dow command

30 15 * * * fri /home/martin/bin/backup.sh

Jaunty Ubuntu NBR – favourites

29, August 2009 by wobblybob9

Using Ubuntu NBR [Jaunty], When I right clicked on Firefox 3 icon in “Favorites” and selected “Remove”, nothing happend. Other icons can be removed and added but not this one. Could it be because I had aready removed Firefox 3 in synaptic in order to install Firefox 3.5? The answer was to remove the icon file firefox-fav.desktop from /usr/share/applications/ using the [terminal] as follows.

sudo rm /usr/share/applications/firefox-fav.desktop

Edit Grub

8, August 2009 by wobblybob9

I had too many entries on the Grub menu and decided to edit it, 1st I opened a Terminal and typed;

sudo cp /boot/grub/menu.lst sudo /boot/grub/menu.lst.back

and hit [Enter], which copies the menu file to a file called menu.lst.back in the same folder.
then I typed;

sudo gedit /boot/grub/menu.lst

This opened the boot menu in the gedit text editor, I then placed # at the start of any line I did not want to show on the menu, re saved it and re booted the laptop all done.

Scanner Support

27, May 2009 by wobblybob9

First the bad news, although some scanners are supported in ubuntu/linux many are either not supported at all or only basic scanning is supported, in my case my Visioneer 4800u is not supported at all! As I wanted to move completely over to ubuntu I decided to buy a second hand scanner from eBay. I checked for compatible scanners on the SANE [Scanner Access Now Easy] project page here by checking out the Supported Devices listed my Manufacturer page. I then bid on a Canon CanoScan N650U Flatbed Scanner and got is for £12.31 including postage [result!]

If your scanner is supported then you may need to add the SANE front and back ends to your system as follows: Open the [Synaptic Package Manager] and add the the following packages;

sane, sane-utls, xsane & xsane-common

You can now plug in your scanner and open the [XSane Image Scanner] from the [Applications], [Graphics] menu and if all goes well your scanner name should show in the dialogue title bar and if you press Scan you should be up and running.

Ubuntu Gusty v7.10 and possibly older versions may need to have scanbuttond (yes there is a d at the end) running for the scanner operation to be detected. To add the scanbuttond type the following in a [Terminal];

sudo apt-get install scanbuttoned

To run the program manually type the following after the prompt;

scanbuttond

To make this program run at start-up so you don’t have to do this each time you want to scan open [System], [Preferences], [Sessions] click on the [Start-up Programs] Tab then click the [+ Add] button. A new window will appear, add [Scanbutton] in the [Name] field and scanbuttond in the [Command] field [remember the "d" at the end of scanbuttond, then [OK] that and [Close] when you re start the PC scanbuttond will be running.

Some command line scanner options to try, type or copy and paste the following into the [Terminal] after the prompt;

This will produce a scan without using the XScane graphical interface

scanimage -x 210 -y 290 –resolution 400 –mode Color > /home/yourname/output.jpg

change [yourname] for the name of your [Home] folder and this should produce a scan called output.jpg.

These command line options will help identify your scanner for problem solving;

sane-find-scanner -v -v

scanimage -L

cat /proc/bus/usb/devices

redirect their output to a text file to make things easier by adding >> scanner_test.txt to the end of each line. The >> part appends the text to the end of the last so you will not overwrite the output from the last command.

sane-find-scanner -v -v >> scanner_test.txt

or use this script, create the script file using;

touch scanner_test.sh

open the file with;

gedit scanner_test.sh

then copy and paste the text below into it.

#!/bin/sh
## created by Martin Cooper 27 May, 2009 ##
##
echo “Scanner test script” >> scanner_test.txt
echo “sane-find-scanner -v -v output” >> scanner_test.txt
echo “*********************************************” >> scanner_test.txt
sane-find-scanner -v -v >> scanner_test.txt
echo “scanimage -L output” >> scanner_test.txt
echo “*********************************************” >> scanner_test.txt
scanimage -L >> scanner_test.txt
echo “cat /proc/bus/usb/devices” >> scanner_test.txt
echo “*********************************************” >> scanner_test.txt
cat /proc/bus/usb/devices >> scanner_test.txt

now save the file and make it executable with;

chmod +x ~/scanner_test.sh

and now run it by running this command

./scanner_test.sh

or double click on the file. The result will now be in the file scanner_test.txt in your home Directory.

Notes: Feisty v 7.04 onwards Gnome Desktop

Desktop launcher menu items

27, May 2009 by wobblybob9

Create a Gnome Desktop launcher for a program that does not create one of it’s own via the command line.

The basic format for a Desktop launcher is;

[Desktop Entry]
Name=Songbird
Comment=Media Player
Exec=/home/user/Songbird/songbird
Icon=/home/user/Icons/songbird.png
Terminal=false
Type=Application
Categories=Application;AudioVideo;

Open a text editor and copy & paste the above text into it, changing the following options;

Name: The name you wants to see in the menu for the program.
Comment: The message the comes up when you fover over the menu item.
Exec: the command that start the program.
Icon: the path to an icon of your choice.
Terminal: leave as false to not open in a [Terminal].
Type: leave as Application.
Categories: listed below;
Internet is Network
Sound & Vision is AudioVideo
Games is Game
Office is Office
Accessories is Utility
Graphics is Graphics
Programming is Development
System Tools is System
System preferences is settings

save it naming it your_name-name_of_program.desktop i.e. martin-songbird.desktop

The first part of the file name can be anything you like but must be there as the file must have the format name-prog_name.desktop. You should now have a desktop icon in you home Directory which you can then click on to open the program. If nothing happens and you need to edit the file the easiest way is to open it from a [terminal] using the following command;

gedit martin-songbird.desktop

or by opening your favorite test editor and then opening the file from it as nautilus cannot open these files and does not display the full file name. You can now move this icon to your Desktop if you wish or add it to your Applications menu using the following command;

xdg-desktop-menu install ./martin-songbird.desktop

Notes: Ubuntu Jaunty Gnome Desktop