Cool page describing firewall set up
Quick HowTo Ch14 Linux Firewalls Using IPTables
Diclaimer on cookies. For those of you in Europe, this blog may use third party cookies to which we have no responsibility for. The cookies will mainly be used for targeted advertising since this site uses Google's advertising system. If you have any doubts you should review the cookies appearing in your browser.
Tuesday, October 26, 2010
Monday, October 25, 2010
Saturday, August 21, 2010
Moving Windows the easy way
(WARNING you need to take great care in this process and know which is your original disk. This example assumes the /dev/sda is the disk with your working operating system and data on and /dev/sdb is the one that is going to be the new one).
Partition 1 - Windows
Other partitions are Linux based file systems.
Most sites will tell you that you can't just move Windows from one disk to another without having to do an ASR (Automated Systems Recovery), well that's just a load of BS and comes from a bunch of I.T. people that really don't understand computer systems properly.
So here is how it's done without having to do anything apart from move the partitions from one disk to another using a real tool.
Preparing the disk
- First acquire a copy of Linux. Any one will do that will allow you to boot a command line via a rescue system. I used Fedora 12 DVD
- Boot the Fedora 12 DVD with only your main drive (still in the system) attached
- At the options menu select the Rescue option, but press the TAB key and delete the entire line
- Replace the line with linux rescue and press enter
- Accept the language you need and the keyboard layout
- Say no to the network being started
- Do not mount or search for existing systems
- Select the Shell option
- You will now have a bash Linux command line and some lovely utilities
- Plug in your external drive that will be your new O/S disk
- Use fdisk to set up the partitions, ensuring that the sizes are exactly the same between the disks. Use the fdisk -l option to list the disks and see the partition information for both disks. Keep typing fdisk -l until you see /dev/sda and /dev/sdb or at least 2 disks
- Your primary disk (the one with the operating system on it currently) should be /dev/sda if it's a SATA drive like mine. And the USB external drive will be /dev/sdb (if there are no other disks in your system)
- Type fdisk /dev/sdb to modify the layout of the external disk
d will delete a partition
n will create a new partition
p will print the partition table
w will save the partition table
a will allow you to set the active boot partition - You will need all of the above commands to set up your disk to be the new O/S disk
- Delete any partitions that are on the new disk (/dev/sdb)
- Hopefully the geometry of the disks will be similar so that when you create a new partition you should be able to use the same Start and End cylinders as the old disk. You can check by the number of blocks, which should be the same for each corresponding file system e.g.
/dev/sda1 1 1912 15358108+ 7 HPFS/NTFS
/dev/sdb1 1 1912 15358108+ 7 HPFS/NTFS - Once you have set all of the partitions to their correct size and marked the relevant partition as the active boot (you can identify this by looking for the * against the device) then we can start copying the partitions between the disks
Copying the partitions
- We will use a command called dd to copy the partitions. This is a byte copying utility that does not care what your data is, it just does the job, unlike these Windows command tools which clearly don't.
- To copy the first partition type
dd if=/dev/sda1 of=/dev/sdb1 - Wait for the command prompt to come back. There is no information displayed on the screen during the copy, but you can tell it to show information
- To see progress of the dd command press ATL+F2 to move to the secondary terminal window
- Type
ps -ef | grep dd - Identify the dd if=/dev.... process ID (PID)
- Type
kill -USR1 PIDfromStep6 - Press ALT+F1 to return to the original screen where dd is running and notice the information on the screen. It will tell you how much has been transferred so far and how fast the transfer is going.
- Repeat the above steps for every partition on the original O/S drive
When the process of copying all the partitions has finished carefully swap the hard disks over. When you start your system you will only need to start it with the new disk.
Starting the system (if you have dual boot)
- Boot from the Fedora DVD
- Select the Linux rescue
- This time follow the instruction and tell it to search for the Linux system
- Tell it to mount the found Linux system to /mnt/sysimage
- Type
cd /mnt/sysimage - Type
chroot /mnt/sysimage - Now we need to ensure that the MBR is correctly written to the disk, so type
grub-install /dev/sda - Type
reboot
Your system can now be started without the DVD and will boot to GRUB, from their you can then choose your operating systems as normal.
If Windows then the system should just boot with no further modifications.
This is all based on the size of your partitions being identical between both disks (even if the sizes of the physical disk are different).
Monday, August 16, 2010
Boot loaders and dual boot systems
Install order no longer matters
Once upon a time it used to matter which order you installed your operating systems when trying to dual boot Windows and Linux/Unix systems. Today that no longer matters and you can install your operating system in any order. The only thing you really need to remember is that your Windows operating system will almost certainly require at least 1 primary partition and so will your Linux system.
Re-instantiating GRUB
If you do decide to install or re-install Windows once you've installed Linux then you'll need to re-instantiate your GRUB boot loader as the primary boot loader. Here are the steps to perform this, for those of you like me who use Linux as their primary OS, but due to the rest of the world who seem to think they have to use Windows or MAC OS and you do work for these companies, here are the steps to recovering your boot loader after installing Windows without having to re-install Linux.
- Boot your system using the Linux installation disk
- On some versions of Linux, e.g. Fedora 12 you might want to change the rescue option so that it just has linux rescue instead of all the other options. To do this select the linux rescue option and press tab, then delete the line and type linux rescue
- Follow the instruction up to the point it asks you to find installed systems
- Tell it to skip
- Then select shell option for a command line
- Type fdisk -l to see the hard disks on your system
- Hopefully you remember which one contains GRUB (the /boot) directory since this is the one you now need to set to primary boot
- Type fdisk /dev/XXX where XXX is the name of the device you wish to change the boot flag
- If you can't remember the option to toggle the boot flag type m and press enter
- Type p to print the partition table and note which partition has the * as this is the current boot partition
- Type the letter a to change the boot flag
- Type the number of the partition that currently has the *
- Type a and then type the number of the partition that contains the GRUB boot loader
- Type w to save the partition table
- Start the system from the Linux install media as above, but this time do tell the system to search for Linux installations
- If it successfully finds your Linux installation it will generally mount it to /mnt/sysimage
- cd /mnt/sysimage
- chroot /mnt/sysimage
- Now we wish to re-install the GRUB boot loader. To do this type grub-install /dev/XXX where XXX is the disk and partition number where GRUB should be installed, that is where the /boot directory is
- Provided that your GRUB boot loader is in /boot, if it's not then you will need to look at the man page to see what option you need
Once done your system will reboot with the GRUB boot loader, and as long as you know the GRUB options to make Windows boot you should be able to add this to your boot loader.
Typical grub.conf Windows settings are;
rootnoverify (hd0,0)
chainloader +1
Where hd0,0 is the disk number and partition number where Windows boot loader resides.
Labels:
boot loader,
dual boot,
grub,
MBR,
windows linux
Thursday, June 10, 2010
Setting up SSH Agent and solving agent issues when prompting for rsa password
Setting up SSH-Agent
1. Generate your key
ssh-keygen -t rsa
2. Copy the public key to the authorized_keys file
cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
3. Copy the public key to the remote hosts
scp ~/.ssh/id_rsa.pub seasnake.techops.uk.betfair:~/.ssh/authorized_keys
If you are prompted for your id_rsa passkey do the following;
If using a windowing environment you may have set ssh-agent running in one window, therefore your SSH_AUTH_SOCK variable needs to be set in the other windows;
1. In the window that allows you to ssh without specifying a password of any kind type;
echo $SSH_AUTH_SOCK
2. Using the value returned, in the other terminal windows type;
SSH_AUTH_SOCK=
If you can't connect without a password on any terminals do the following;
1. Find the current ssh agent
ps -ef | grep ssh
2. kill the ssh-agent process
kill
3. Start a new ssh-agent process and set the shell variables
eval `ssh-agent`
4. Check that your SSH_AUTH_SOCK is set
echo $SSH_AUTH_SOCK
5. Now add your key to the agent
ssh-add
6. Enter your id_rsa password when prompted
7. Log on to your remote system without the password.
Saturday, June 5, 2010
Cool Fedora core tripwire setup page
http://www.syntaxtechnology.com/2009/07/install-tripwire-on-fedora-11/
http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/ref-guide/ch-tripwire.html
Although the version that installs with FC12 you only need do the following steps;
$> tripwire-setup-keyfiles
Follow the instructions, which mainly require 2 passwords, 1 for site and 1 for local
Once this step is completed you simply run;
$> tripwire --init
And wait for it to complete
Updates can be done by first dumping the policy file;
$> twadmin --print-polfile >my.pol
And then editing this file accordingly. Once you have completed your edits you would then need to encrypt the file for the init process to be able to use it. This will generate the tw.pol file;
$> /usr/sbin/twadmin --create-polfile -S site.key /etc/tripwire/my.pol
You will be prompted for your site password
To load the policy into the tripwire database;
$> rm /var/lib/tripwire/hostname.localdomain.twd
Run the following to regenerate the database;
$> tripwire --init
Test if your email account will work;
$> tripwire --test --email username
View reports;
$> /usr/sbin/twprint -m r --twrfile /var/lib/tripwire/report/ .twr
Update database;
$> /usr/sbin/tripwire --update --twrfile /var/lib/tripwire/report/ .twr
Monday, May 10, 2010
Linux Stuff
Timezone settings for CentOS/RedHat
/etc/localtime is the file that deals with time zones.
Files in /usr/share/zoneinfo are what can be used to change these times.
So if your system was installed using BST and you want UTC do the following;
mv /etc/localtime /etc/bst-localtime
ln -s /usr/share/zoneinfo/UTC localtime
Tuesday, April 13, 2010
First accessories for the iPad
You heard it here first, so it's my copyright April 2010.
The new iPad from Apple needs some accessories, so here are 2. Watch this space for the design. But here is the concept and if anyone comes up with them then they will have to owe me.
iWings
This is a protective case for the iPad which protects the screen with door style flaps which fold back to look like wings (think time of the month, lilettes). The flaps will naturally fold back to ensure the screen is protected at all times, but allow you to hold your iPad like a book.
The Clamp-On
A clamp that allows you to hold the iWings round the back of the iPad, and will stand your iPad at a convenient angle on a desk to allow you to read it hands free.
Remember you heard it here first.
Subscribe to:
Posts (Atom)