General HowTo’s for Reference

Screen & IRSSI, a nice intro & howto:

An excellent write-up on CRON and ANACRON.

Filters and Pipes:

Asterisk HowTo (from scratch):

IRC Channel & User modes document:

How to create .ISO files from DVD/CD’s and access them off your hard drive virtually, without the need to put the disc in again:

Put the CD in, then …

$ sudo umount /dev/cdrom && dd if=/dev/cdrom of=filename.iso bs=1024

You can also do the same with folders:

$ mkisofs -r -o file.iso /location_of_folder/

You can keep all your .ISO files in one directory (called “iso” for example). Assuming you have such a directory where your .ISO files are stored:

To mount the ISO:

$ mount /home/username/iso/NameOfTheISO.iso /home/username/iso/nameoftheiso.iso -o loop

$ mount -o loop -t iso9660 foo.iso /mountpoint (if it was an .ISO made from a CD)

The loop device is a device driver that allows an image file to be mounted as though it were a normal block device, such as a CDROM.

“When you’re done, simply unmount the ISO …

$ umount /home/username/filename.iso

How to mount .ISO files and interact with the contents over a virtual directory:

This is easy in Linux. First you must make a directory for the mount to exist in (you may create the directory as a non-root user).

$ mkdir /home/username/iso

Then, simply mount the ISO making reference to the directory you just made …

$ mount NameOfTheISO.iso /home/username/iso -o loop

The loop device is a device driver that allows an image file to be mounted as though it were a normal block device, such as a CDROM.

“When you’re done, simply unmount the ISO …

$ umount /home/username/iso

If you get a Valicert not Trusted error when trying to use Citrix Metaframe web portal:

Download this (rt click, save link as) valicert certificate file.

Place the file in /home/usename/ICAClient/linuxx86/keystore/cacerts

(cert file downloaded from: here.)

Howto Re-install Grub after windows wipes it out (if installing Windows after Ubuntu in a dual-boot capacity):

If you have a good install of Ubuntu and later decide to install Windows, as a dual-boot, you wouldn’t want to wipe your fine Ubuntu install. If you install Windows *after* Ubuntu, Windows will wipe the Ubuntu boot loader in favor of its own, locking you out of the option to boot into Ubuntu. To re-install the Grub boot loader, which will give you the option to boot into Windows or Ubuntu, do the following.


1) Boot off the Ubuntu LiveCD.

2) Open a Terminal (Applications-Accessories-Terminal) and type in the following commands, noting that the first command will put you into the grub “prompt”, and the next 3 commands will be executed from there. Also note that hd0,0 implies the first hard drive (hd0) and the first partition (the 0 after the comma) on that drive, which is where you probably installed grub to during installation. If not, then adjust accordingly.

sudo grub
> root (hd0,0)
> setup (hd0)
> exit

4) Reboot (removing the livecd), and your boot menu should be back.

5) Open the grub file:

sudo gedit /boot/grub/menu.lst

6) Scroll to the bottom and add the following:

title Windows XP
root (hd0,0)
makeactive
chainloader +1

Note that you should also verify that hd0,0 is the correct location for Windows. If you had installed Windows on the 4th partition on the drive, then you should change it to (hd0,3), since partition counting begins at 0, the 4th partition on the first hard drive would be 0,3 not 0,4 (that would be the fifth).

How to add your own custom TrueType Fonts to your Ubuntu (or generic) Linux system (the manual way):

There is a great set of fonts that RedHat released to the public called Liberation Fonts, they’re .ttf fonts, so you’ll need to follow the instructions below to install truetype fonts.

Also, to get the free commonly used Microsoft fonts, you don’t need to manually install them. Simply typing this will retrieve them & auto-install them:

sudo apt-get install msttcorefonts

Now, as to the instructions to install any TrueType font (including the Liberation fonts from Redhat), follow these instructions:

1. You need to create a location where your custom fonts will reside. Drop to command line and type:

cd /usr/share/fonts/truetype

In there you want to make a ‘custom’ directory for yourself, so if it doesn’t already exist type this:

sudo mkdir custom

2. Assuming you’ve been downloading your fonts into a fonts directory in your home directory and storing them there, you’ll need to copy them to this new custom folder so that Linux can see them as available to the system.

sudo cp /home/yourname/fonts/*.ttf /usr/share/fonts/truetyp/custom

3. You must ensure that root owns these fonts, otherwise they will not be available to the system, so from within your custom folder, type:

sudo chown root.root *.ttf

4. Now you simply have to reload the font cache so it’s available to your applications:

sudo fc-cache -f -v

Now, your fonts will be made available to your system and applications!

How to create a dynamic proxy via SSH:

SSH can serve as the proxy, allowing you to connect to shell.example.org and make connections from there to an arbitrary server such as mail.example.net. Simply run:

ssh -D 1080 shell.example.org

to make the connection to shell.example.org and start a SOCKS proxy on localhost port 1080.

Standard SSH local/remote port forwarding:

With standard SSH port forwarding, you could enter the command:

ssh -L 2525:mail.example.net:25 shell.example.org

This will forward port 2525 on your machine to port 25 on mail.example.net, by way of shell.example.org. You will then need to configure your mailer to send mail to localhost, port 2525, and use the authentication information for your mail account on mail.example.net.

How to maintain an SSH connection (keep it alive, from the client side):

Add this line to your local ssh_config in /etc/ssh (on the client side!)

ServerAliveInterval 180

How to mount a new hard disk inserted into a Linux system:

Open a terminal window and enter the following commands —

(1) Create the Mount Point

sudo mkdir /nas2

(2) Back up the /etc/fstab file.

sudo cp /etc/fstab /etc/fstab-backup

(3) Edit the /etc/fstab file and add the new partition to /etc/fstab. Since the file is owned by “root”, we need to use sudo to start an editor.

sudo nano /etc/fstab

Add this line to /etc/fstab. Use tab instead of space to separate the various columns.

/dev/sda1 /nas2 ext3 defaults 0 0

To save your changes, press Control-X for save, Y to confirm, and then press Enter to exit.(4) We have made changes to the /etc/fstab file, so let ask Ubuntu to mount the drives again

sudo mount -a

(5)Now give ourselves proper permissions to use the new drive. Assume in this example that my userid is “freddie”.

sudo chown -R freddie:freddie /nas2
sudo chmod -R 755 /nas2

Now the new drive is mounted as /nas2 and is ready to use.One more ThingAlso, as a convenience and ease of use, you can also create a symbolic link (using the ln -s command) on your desktop back to the /nas2 folder. Just click on the new link to open the folder in the default file browser.

How to set up SAMBA on Linux, so Windows can mount shares sitting on Linux boxes:

To install: sudo apt-get install samba

Once the server is install, issue the following command:

sudo gedit /etc/samba/smb.conf

Make the following changes:

workgroup = WORKGROUP

underneath it, add

netbios name = name_of_your_server (no spaces)

For example:

netbios name = kenny_smb_server

Make sure “security” is set to “user” (this will only allow users created on the linux box as valid usernames to mount the Linux shares as opposed to windows-users)

Scroll down until you see “[homes]”, set: (remove the ; and modify the no’s to yes’ and vice-versa, or just leave the ; lines alone and type up your own….)

browseable = yes
writable = yes

Then save the changes.

Finally, create a SMB user, make sure this account exists on your Ubuntu Linux. Take an existing user (or add a new one) that is valid on your linux box and for that username type …

sudo smbpasswd -a username

you will be asked for the samba-specific password for this linux user (this will be the password you will use to mount the shares, instead of the user’s real password on the linux box).

OKAY, you are finished configuring Samba on your Ubuntu Linux.

————————————————————————————————

Now for the Windown side…

There are two ways to access it:

Method 1:

My network places > Entire Network > My Windows Network > Workgroup
You should see a folder call “homes”, click on it, and it will ask you for your username and password, enter your Ubuntu Login Name and whatever you choose for the password when you used command “smbpasswd”. You should be able to take it from here.

Method 2:

In start\run type in “\\[whatever you named the Samba server]”. From my example above, I used “\\kenny_smb_server\”. You can also hit it by IP .. \\192.168.1.10\name-of-linux-user (will mount their Home).

Keep in mind that you are sharing, /home/[linux login name]/*

How to mount windows shares from Linux, permanently (requires entries in /etc/fstab):

How to reset Gnome settings to defaults if messed up or if Gnome doesn’t load-up or look right:

If you don’t have access to your graphical (GUI) desktop to delete these folders in Nautilus or you’re stuck at the login screen, drop to a terminal by hitting CTRL + ALT + F1, login to your account, and run this command:

 

rm -rf .gnome .gnome2 .gconf .gconfd .metacity

Get back to your GUI desktop by hitting CTRL + ALT + F7.

This will not fix any video issues or Xorg.conf issues, just Gnome-specific issues.

How to format a drive with XFS: (Excellent link with some instructions).

1. Dismount the drive

2. sudo apt-get install xfsprogs

3. sudo mkfs.xfs /dev/sdc1 -f (where -f is FORCE write), wait a few seconds as it writes the sectors.

4. To label a HDD with a label name, simply type, “sudo xfs_admin -L media /dev/sdg1”. where “media” is the label name, and “sdg1” is the device.

5. Mount the drive (sudo mount -t xfs /dev/sda1 /mnt/blah) or powercycle the external drive or computer to allow Linux to auto-mount (not applicable if it's an OS boot drive), applicable if it's an external USB drive.

6. sudo chown -R username:username /mount/point (allows you to write to the drive as a non-root user).

7. To set up automounting of the drive in Fstab, you’ll need the USB drive’s UUID tag. Find this by typing:

sudo blkid device

where device is the /dev entry for the partition you want to know about.  for example,

sudo blkid /dev/hdc3

This will return the UUID of that drive (whether mounted or not). You can also just run “sudo blkid” by itself and it will give you the UUID tags for all your devices.

8. Modify your /etc/fstab file: (gksudo /etc/fstab) and add the following at the bottom

UUID=23d3ccfa-8c35-3638-c6f2-6c5b4231d5bd    /media/2TB_2ndary    xfs    defaults    0 0

This assumes the drive was formatted with XFS, of course. Just put <tab>’s between each section.

9. Step 8 will mount the drives on a reboot, but if you want to mount them manually, just type “sudo mount -a” or “mount -t xfs /dev/sdx1 /media/mountdir” where sdx1 is the actual device of the drive in question and /media/mountdir is the directory you’ve chosen as a mount point.

How to install Adobe Reader on Ubuntu Hardy 8.04

1. Click here.

How to reset a lost password in Linux

1. Click here.

Article on SafeSQUID (content filter-based proxy module)

1. Click here.

How to set up a PPTP (VPN) server compatible with MS boxes on Ubuntu:

1. Click here.

How to ENCRYPT a plaintext file into ascii-armored text:

1. gpg –text –armor -c ./filename (where “filename” is the name of the file to encrypt).