Archive for the ‘Tech’ Category

by @ 20:42   Linux / Unix | Tech   Permalink

Mount network shares at boot. (Ubuntu)

Monday, March 10th, 2008

If, like me you have your media and web server kept on another machine, and get annoyed having to put your username and password in each time you want to grab a file or listen to music, then this is for you.

This is the most secure method I could come up with, simply put, if your main machine is not logged on as you, then the shares cannot be accessed without the username and password. When you are logged on these details will be called from a file that is owned by the root user.

This tutorial will assume you have samba already installed on your media/web server. Without it, this will not work.

The following must be done on the SERVER machine

  1. sudo gedit /etc/samba/smb.conf

I am using GEDIT here to make it easier for you to amend the file. I much prefer PICO, or you may wish to use VI, if your balls are bigger than King Kongs.

Make the following changes:

  1. workgroup = “WORKGROUP”

Note: The name of the workgroup (in quotes) must be the same on your windows and/or your Ubuntu box. If you do not know the name or your workgroup, look under “My Network Places” on your windows box, select “Microsoft Windows Network” and you will see a list of your workgroups. Default workgroup on windows XP, home edition is MSHOME (not WORKGROUP).

underneath it, add

  1. netbios name = name_of_your_server (no spaces)

For example

  1. netbios name = my_new_smb_server

Make sure the “security” option is set to “user” before moving on.

Scroll down to the bottom of the file and add the following lines:

  1. [Name_of_folder]
  2. path = /path/to/file
  3. browseable = yes
  4. writable = yes
  5. read only = no
  6. guest ok = no
  7. create mask = 0644
  8. directory mask = 0755
  9. force user = root
  10. force group = root

Do not forget to change the name of the folder and the path to the folder. The name you give this folder will appear in the network folder on your Ubuntu box. ie. Music or Vids etc. and the PATH will be something like this path = /home/user/Music. You will get the jist of it.

Save the changes and close the file.

Restart the samba daemon

  1. sudo /etc/init.d/samba restart

The following must be done on YOUR computer

Open a terminal session and type the following commands one by one, allowing each of them to finish before executing the next one.

  1. sudo apt-get install samba
  2. sudo apt-get install smbfs

Now that you have the core files installed we need to do some configuration.

All folders that you wish to have mounted go into a root level folder called /media. This is much nicer than previous and other version of linux where it was called /mnt. now most will know this means MOUNT but some may not. Anyway, lets get on with it.

Lets make that new directory. If you decided to call your share name “Music” in the part above, you would do this:

  1. sudo mkdir /media/Music

Obviously, you name it how you want it. for example, I have many shares such as /media/Vids, /media/Music, /media/WWW etc etc.

Now type the following command

  1. gksudo gedit /root/.smbcredentials

This will create a hidden file called .smbcredentials in your root folder. We will store your username and password in this file for ease of access later on

Insert the following lines into the file: (substituting “yourusername” and “yourpassword” for your ubuntu machine login details)

  1. username=yourusername
  2. password=yourpassword

Save and exit the file and issue these commands one by one:

  1. sudo chmod 700 /root/.smbcredentials
  2. sudo cp /etc/fstab /etc/fstab_backup
  3. gksudo gedit /etc/fstab

Now you should be presented with another file. In here we will make the mods that mount those folders on boot up so you don’t have to touch them again. Put the following line at the bottom of the file, making the changes to the location of your server machine. for example, mine is at 192.168.1.125 so I would do this

  1. //path_to_server/folder_name /media/folder_name smbfs credentials=/root/.smbcredentials,dmask=777,fmask=777 0 0

Once you have added all your mount points and changed the names to correspnd with your details., save and exit the file.

Now issue this final command:

  1. sudo mount -a

Your new mount points will appear as drive locations on your Desktop and in the Places menu

Page 3 of 512345

Citrix ICA Client install on Ubuntu (Feisty and Gutsy)

Monday, March 10th, 2008

Citrix is a system that allows you to run applications you have at work/home from anywhere in the world or on your local area network (LAN) from a remote workstation.

You have real time access to run your applications as fast as if you are in the office. It does not matter if you’re using a dialup modem, DSL, ISDN, or T1 to access citrix remotely. Connection speeds become even less of an issue with high speed broadband connections pretty much the norm around the world now.

Citrix was built for virtualisation in mind, and obvioulsy owing to the fact that Microsoft is pretty much everywhere these days the main applications are easy to install on a windows machine, I am not going to cover that in the slightest.

To install Citrix ICA presentation client on your Ubuntu PC then follow the steps below.

Open a Terminal session

The three links below are using the new AptURL command which is installed by default on Ubuntu Gutsy and allows people like myself and any other tutorial writer to make it easier for you to install the packages you need. Just click the link and it will install the package for you. If this does not work, type the following command into the terminal window.

  1. sudo apt-get install apturl

Now that is out of the way, continue on.

  1. Click here to install libxaw6
  2. Click here to install libmotif3
  3. Click here to install alien (used to convert RPM to DEB packages)

You will now need to download the RPM file from Citrix. NOTE: It is version 10.6 (at time of writing) and is the second download icon (again, at time of writing). As the file names will change with new releases you will need to modify the tutorial to reflect this. You can however just grab the file from me.

Grab the file from here. I believe it is version 10.0 which is slightly out of date but works solidly so I recommend using it.

  1. http://www.citrix.com/site/SS/downloads/details.asp?dID=2755&downloadID=3323#top

Save the file to your desktop (this tutorial assumes you save it to your desktop, if not please change commands accordingly)

In your terminal window you now need to change to the directory where you saved the file, then we will begin converting and installing.

  1. cd Desktop

Now that you are on the desktop we now need to convert the file into a .Deb package that Ubuntu can handle.

  1. sudo alien ICAClient-10.0-2.i386.rpm

Once the file is converted we now need to install it.

  1. sudo dpkg -i icaclient_10.0-3_i386.deb

Now need to make this work through Firefox web-browser. We will create some symbolic links for Firefox so that it knows how to open the Citrix application file when you attempt to login.

  1. sudo ln -s /usr/lib/ICAClient/npica.so /usr/lib/mozilla/plugins/npica.so
  2. sudo ln -s /usr/lib/ICAClient/npica.so /usr/lib/mozilla-firefox/plugins/npica.so

Restart Firefox

Navigate to your Citrix server and login. Click on the application you want to launch. If it asks you to save/open with you will need to choose “open with” and navigate to the following folder:

  1. /usr/lib/ICAClient

and choose to open with the following application.

  1. wfica

You should now be good to go.

Edit

I am aware that some people get Font errors with the Citrix Client, it is safe to ignore but if you wish to fix them you can drop me a line in the comments and I will write up the fix.

Page 3 of 512345

mod_rewrite on Apache(2) Server

Monday, March 10th, 2008

Mod_Rewrite uses a rule-based rewriting engine (based on a regular-expression parser) to rewrite requested URLs on the fly. It supports an unlimited number of rules and an unlimited number of attached rule conditions for each rule to provide a really flexible and powerful URL manipulation mechanism. The URL manipulations can depend on various tests, for instance server variables, environment variables, HTTP headers, time stamps and even external database lookups in various formats can be used to achieve a really granular URL matching.

In most Apache servers the mod_rewrite module is not activated by default. If you wish to have your URL’s changed on the fly and rewritten into nice, human readable format then you will need to enable this module. Follow the steps below to enable mod_rewrite.

Open a Terminal window and type:

  1. sudo a2enmod

You will be presented with the following, but you can safely ignore what is in front of you and just follow the next steps.

  1. Which module would you like to enable?
  2. Your choices are: actions alias asis auth_basic auth_digest authn_alias authn_anon authn_dbd authn_dbm authn_default authn_file authnz_ldap authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cern_meta cgid cgi charset_lite dav_fs dav dav_lock dbd deflate dir disk_cache dump_io env expires ext_filter file_cache filter headers ident imagemap include info ldap log_forensic mem_cache mime mime_magic mod_python negotiation php5 proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http proxy rewrite setenvif speling ssl status suexec unique_id userdir usertrack version vhost_alias
  3. Module name?

Enter the module name “rewrite” and press enter. Now you need to open the default file with sudo rights and change the “AllowOverride” option from “None” to “All” in the first 2 Blocks.

  1. sudo pico /etc/apache2/sites-enabled/000-default

Below is what it should look like when you are finished.

  1. <VirtualHost *>
  2. ServerAdmin root@xpheas.com
  3. DocumentRoot /var/www
  4. <Directory />
  5. Options FollowSymLinks
  6. AllowOverride All
  7. </Directory>
  8. <Directory /var/www>
  9. Options Indexes FollowSymLinks MultiViews
  10. AllowOverride All
  11. Order allow,deny
  12. allow from all
  13. </Directory>

Restart the webserver.

  1. sudo /etc/init.d/apache2 force-reload

Now the module is enabled, all that is left is to rewrite your .htaccess for URL changing.

Now that you have mod_rewrite enabled you are going to want to use it. In my next tutorial I will show you how to rewrite your .htaccess file to change ugly URLS into nice URLS. An exmaple of each is below so you can understand what I mean.

Ugly URL

  1. http://example.com/blog/?p=17

Nice URL, which of course is more search engine friendly and will provide much better SEO.

  1. http://example.com/blog/index.php/2007/09/17/dont-tase-me-bro/
Page 3 of 512345

Multi-TouchScreen Computing

Thursday, June 7th, 2007

Jeff Han and Phil Davidson over at Perceptive Pixel have created the future in technology and company in industry and hopefully in the home. This technology is called Multi-Touchscreen Computing.

Perceptive Pixel, Inc. was founded by Jeff Han in 2006 as a spinoff of the NYU Courant Institute of Mathematical Sciences to develop and market the most advanced multi-touch system in the world.

The uses for this are endless. Boardrooms, hospitals, military, home cinema. I could go on, but I shall leave it to your imagination.

For more info and to watch the video, please take a visit to Perceptive Pixel where Jeff Han and Phil Davidson will demonstrate how a multi-touch computer screen will change the way we work (and play).

Page 3 of 512345

Install Lexmark Printers (Ubuntu)

Thursday, September 28th, 2006

This tutorial will guide you through installing Lexmark printers on Ubuntu. The tutorial was taken from the Ubuntu forums. I decided to post it here as it did not work exactly like it was supposed to for me and I had to modify the procedure.

I have ammended the tutorial to my needs and probably the needs of most and I have pointed out where it went wrong for me and how I solved it. It was not difficult to solve, but you will be required to be the ROOT user which is dangerous and destructive. Use at your own risk, I take NO responsibility for you damaging your system.

You will of course need to download the correct drivers for this, the Z600 driver. I have the correct link for the file as Lexmarks website is not the easiest to navigate around and find what you need.

The Z600 driver has been confirmed to work with the following printers:

Lexmark 5700 (black & white only)
Lexmark X1100
Lexmark X1110
Lexmark X1130
Lexmark X1140
Lexmark X1150
Lexmark X1180
Lexmark X1185
Lexmark Z513
Lexmark Z515
Lexmark Z715
Lexmark Z55
Lexmark Z615
Lexmark Z705
Lexmark Z605
Lexmark Z600
Lexmark Z25
Dell A920
Z65 (z65 driver)
Lexmark Z33 (z35 driver)
Lexmark Z33 (z35 driver)

First of all you need to download the correct driver to a folder of it’s own to save confusion.

Open a terminal window and type the following

sudo mkdir lexmark

This will create a folder called “lexmark” in your home directory.

Ok, again in your terminal window, type the following commands one after another, waiting for each command to execute first before starting the next one.

cd lexmark

wget http://www.downloaddelivery.com/srfilecache/CJLZ600LE-CUPS-1.0-1.TAR.gz

tar -xvzf CJLZ600LE-CUPS-1.0-1.TAR.gz

tail -n +143 z600cups-1.0-1.gz.sh > install.tar.gz

tar -xvzf install.tar.gz

sudo apt-get install alien

alien -t z600cups-1.0-1.i386.rpm

alien -t z600llpddk-2.0-1.i386.rpm

sudo tar xvzf z600llpddk-2.0.tgz -C /

sudo tar xvzf z600cups-1.0.tgz -C /

sudo ldconfig

cd /usr/share/cups/model

sudo gunzip Lexmark-Z600-lxz600cj-cups.ppd.gz

The driver is now installed. Restart the cups daemon:

sudo /etc/rc2.d/S19cupsys restart

Check to make sure the printer back-end works:

cd /usr/lib/cups/backend

./z600

The output of the above command should be similar to this:

direct z600:/dev/usb/lp0 “Lexmark Lexmark Z600 Series” “Lexmark Printer”

If you get no output, mount the usb filesystem. To do this type the following:

sudo gedit /etc/fstab

and add the following code to the end of the file

#USB Lexmark Printer
usbfs /proc/bus/usb usbfs devgid=14,devmode=0660 0 0

Save the file and close. Then just type the following in the terminal:

sudo mount usbfs

That should fix it.

Now simply set up your printer. Go to:

  • System
  • Administration
  • Printing

Make sure you select the z600 driver, and you’re done. Print out a test page to make sure it all works.

I hope this has helped you.

Page 3 of 512345

Contact