How to SSH into your home computer to access media files, documents, processes, or anything else you might need

I wanted access to my home machine so I could access any files I want. Dropbox is pretty awesome, but if you’ve forgotten to put something in your Dropbox folder, you’ll be in deep trouble.

(1) Run “sudo apt-get install openssh-server” at the command line.

(2) Run “sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.original”. This copies your original configuration file for SSH so if you muck up the settings, you can always replace them.

(3) Run “sudo kate /etc/ssh/sshd_config” (or whatever text editor you use) and change the port number from 22 to another port so you won’t be targeted by so many bots.

(4) Ensure that your firewall isn’t blocking the port you chose. You may need to add SSH as a running service. You should probably also include ‘sshd’ as a startup application in your distro so that if you need to do a remote reboot, the service restarts and you can log back in.

(5) Forward the port
being used for SSH in your router. To do this, you need the internal IP address of your computer on your home network, as I presume you’re not dumb enough to directly connect your home machine to a modem. Ask me if you have problems figuring out how to forward the port.

(6) Get out your Android phone if you have one, since a connection over 3G will mean that you can test your SSH connection without ever leaving your comfy chair. Install ConnectBot through Android Market.

(7) Open ConnectBot (or any SSH client from any machine; Putty will work well) and type in your home machine username, your external IP address, and if you have changed the port, include that as well. Here’s the format: username@000.000.000.000:XXXXX Where 000.000.000.000 is your external IP address and XXXXX is the port number you chose to replace the default.

(8) If you have issues getting a connection, hit me in the comments; I had several oddities in router configuration making this work, even though it’s
quite simple in theory.

How to hack a hard drive in almost any OS.

Most of you know that it’s simple to get around the password-protection in almost any OS. I startled the heck out of my brother two days ago when I popped a Meerkat disk into his machine, booted up, mounted his data partition, and pwned his WoW folder, all without breaking a sweat or needing any password. He simply didn’t realize how easy it is.

Here’s the steps:

(1) Make a Live CD from any *Buntu distro. I heart Kubuntu, and 10.10 works just fine.

(2) Insert the disk into a target computer, and reboot into the “Try Kubuntu Without Installing” option.

(3) Open a terminal. Navigate to the top level of the file system. Navigate into the device directory. Look for all the devices listed:


cd ..
cd ..
cd /dev/
ls


Is something like sda1 there? Usually, the hard drive will be named sda or hda. The first partition, sda1 or hda1, will be the data partition, especially if there are no
more partitions. If you see sdb or hdb, that means there’s likely a second hard drive; check those partitions as well.

(4) Now that you’ve found what is likely to be the data partition, create a working folder and mount the partition to it:


sudo mkdir /home/pwnage
sudo mount /dev/sda1 /home/pwnage
cd /home/pwnage
ls


Do you see the files?

You’re welcome. Questions, anyone?

How to batch scan using Xsane

If you’re like me, you can’t throw important documents away, but there’s no easy way to scan old records, tax documents, and all the crap you’re supposed to save for 7 or 10 years…or however long taxes are supposed to stick around. Unfortunately, batch scanning with Xsane using an ADF (auto document feeder) is not even remotely intuitive.

Here’s how to do it (I have an HP Officejet 6500, a relatively common all-in-one printer using hplip for drivers):

(1) Open Xsane. Choose the correct printer/scanner; it’s likely to be the top one in the list.

(2) There’s a tiny ticker field in the top left corner of the main Xsane window with no label on it. Set that to 40 or so (however many documents your ADF can take at a time, plus 5 or 10). You do that because if you leave it set at 1, Xsane will assume that you only want to scan the first document in the ADF. This way it knows to look for 40, and will quit afterwards. The
other alternative is to set it at 30 or so, and push the scan button again after it’s stopped (if there are documents still in the ADF).

(3) Set the dropdown on the top right to “Multipage”. Ignore “batch scan” and the advanced settings.

(4) Create a working directory, and be sure to chmod and chown that directory recursively.*

(5) Create the multipage project in that directory. Set the output to PDF (if that’s what you want. PDF is probably best for archiving documents).

(6) Put a load of documents into your ADF, and hit ‘scan’ in the main Xsane window.

(7) Once they’re done, either load more and keep hitting the scan button to do batches of documents, or hit the “save multipage file” button at the bottom of the multipage project window.

Voila!

*You may have issues using the multipage project mode in Xsane if you don’t have proper read/write permissions set on your directory.

Open a terminal.

Enter at the prompt: sudo
chmod -R a+rwx /yourHome/yourWorkingDirectory

Enter at the prompt: sudo chown -R yourUserName /yourHome/yourWorkingDirectory

Triple booting Linux distros with a mix of GRUB2 and GRUB legacy, Part 2

Instructions on how to multi-boot with a mix of legacy and 2.

DISCLAIMER: this method erases your entire hard drive and repartitions it. If you are uncomfortable mucking about with partition tables, go look at some beginner resources and tutorials on fdisk, gparted, and disk partitioning in general. This is not a method or tutorial intended for n00bs; there are some advanced concepts here. Be prepared to start from the beginning a few times if you mess up; since you’re wiping and repartitioning from the start, you won’t have lost anything but time. I restarted this a couple of times before I got it right.

THEN I wrote it down so I could look all smart and stuff.

DID YOU BACK UP AND REMOVE ALL DATA FROM THIS DRIVE? If so, proceed.
_______________________________________________________

    (1) Determine in advance which distros use legacy and 2.

    (2) Pick the legacy distro which has the easiest, most
    attractive boot screen. In my case, it was openSUSE.

    (3) Get ready to use that one first.

    (4) Use an Ubuntu LiveCD (even if you’re not planning on installing this distro, since the Ubuntu LiveCD is the most intuitive and useful) to boot from CD. Do not install anything at this time.

    (5) Using your favorite disk partitioning tool (gdisk, fdisk, gparted, etc), partition your hard drive into: (1) a teeny boot partition; (2) swap area; (3) root partitions for each of your distros that are at least 10GB in size; (4) home partitions for each of your distros that are at least 10GB in size; (5) a mega big data partition.

    (5a) To install and use gdisk from the Ubuntu LiveCD, open a browser, go here: http://sourceforge.net/projects/gptfdisk/files/gptfdisk/0.6.10/gdisk_0.6.10-1_i386.deb/download, download it to any folder (the default will be /Desktop), open a terminal shell, navigate to that folder, and use this command: sudo dpkg -i gdisk_0.6.10-1_i386.deb.

    (5b)
    Instructions on using gdisk (with thanks to srs5694 from the Ubuntu Forums) if necessary:

    (5c) Boot an Ubuntu installer or an emergency disc, like Parted Magic or System Rescue CD. If using an Ubuntu installer, boot it into a recovery mode so that you can get a shell rather than booting straight into the installer.

    (5d) Launch a text-mode shell. If you’re using an Ubuntu installer, type “sudo apt-get install gdisk” to obtain and install GPT fdisk (gdisk). If this doesn’t work, use the method I described above to get gdisk.

    (5e) Type “sudo gdisk /dev/sda” (you can omit “sudo” on some emergency disks).

    (5f) Type “o” and answer “y” to the verification prompt to create a fresh partition table. Note that this will wipe out all your existing partitions.

    (5g) Type “n” to create a new partition. Give values of: partition #1, start sector 2048, end sector +1M, hex code of EF02. This creates the BIOS Boot Partition.

    (5h) Type “n” to create another new
    partition. Give values of: partition #2, hit enter for the default start sector, end sector +20G (or however big you want the Ubuntu main installation to be, minus space for your user files), hex code of 0700 (the default). This creates what will be the Linux root (/) partition.

    (5i) Type “n” to create another new partition. Give values of: partition #3, hit enter for the default start sector, end sector +2G (or however big you want to make your swap space), hex code of 8200. This creates a Linux swap partition.

    (5j) Type “n” to create another new partition. Give values of: partition #4, hit enter for the default start sector, hit enter for the default end sector (to use the whole disk), hex code 0700 (the default). This creates what will be the Linux /home partition. If you want other partitions, you should set some other end value and create additional partitions at this point.

    (5k) Type “p” to review your partition table. It should have an EF02 BIOS Boot Partition, two
    Linux/Windows data partitions, and a Linux swap partition. If it doesn’t, correct the problems or quit by typing “q” and start again.

    (5l) Type “w” to save the partition table.

    (5m) If necessary, reboot into the Ubuntu installer; or just launch the installation process. When you get to the disk partitioning section, tell the system to do custom partitioning, but do not start from scratch. Instead, tell it to use /dev/sda2 as root (/), /dev/sda3 as swap, and /dev/sda4 as /home. (Adjust these partition IDs as necessary, if you deviated from the numbers I specified earlier.) The installer will create new filesystems or swap space on these partitions. You should not tell the installer to do anything with /dev/sda1; when the system installs GRUB, the GRUB installer should use /dev/sda1 automatically.

    (6) Now, install your chosen legacy distro to the first root partition you want, with its data at its own home. Mount the big data partition as /data or whatever you want. Do not mount
    the other partitions; those are for your other distros.

    (6a) When installing the bootloader, specify that it’s to be installed to the hard disk. Grub legacy will find the mini partition and do its thing.

    (7) Check to find out if the BIOS partition has its boot flag flying.

    (7a) Boot a live disk of some kind; Ubuntu LiveCD works.

    (7b) Launch a shell.

    (7c) Type “sudo fdisk /dev/sda”.

    (7d) Type “p” to view the MBR partition table. It should show one partition, with “ee” in the “Id” column. This is normal, even though you created several GPT partitions. Is there a ” * ” under the Boot column? If not, proceed with steps 7e-7h.

    (7e) Type “a” and enter “1” (or whatever the partition number is) when prompted.

    (7f) Type “p” again. You should now see an “*” under the “Boot” column.

    (7g) Type “w” to save the changes.

    (7h) Remove the emergency CD and reboot. You should not need to re-install.

    (8) Install the other
    distros to their own root partitions; the legacy ones first. You may need to reflag the BIOS boot partition after each install; you DEFINITELY need to specify that each distro’s bootloader is to be installed to its own root partition. IF YOU DO NOT DO THIS, YOU MAY OVERWRITE THE BIOS BOOT PARTITION AND NEED TO START FROM THE BEGINNING.

    (9) Install any Grub 2 distros, also specifying the bootloader installation to their own root partitions.

    (10) Run sudo update-grub from your first distro. After booting, check to make sure that you have boot options for each of your other distros. If not, you may need to add chainloading boot entries.

    (10a) For further discussion on chainloading (dead simple and requires minimal editing of your /boot/grub/menu.lst file), see here: http://www.linuxquestions.org/linux/answers/Applications_GUI_Multimedia/Chainloading_in_Linux

After each install, I checked, updated grub, added the relevant entries, reflagged the boot partition,
and by the time I was done, I was triple booting.

Any questions?

Triple booting Linux distros with a mix of GRUB2 and GRUB legacy, Part 1

I’ve been experimenting with other distros. I just got a 2TB internal Western Digital Caviar Black, and there’s just too much room there NOT to create nine partitions and get my distro freak on.

I know, Kubuntu baybee, but it’s not you, it’s me. I just can’t stay faithful to one distro, and you KNEW that when you seduced me with your ease of installation, friendly user community, and sexy Compiz+KDE desktop. Let’s still be friends, and you’ll always be my main squeeze.

As with so many other things, as long as you know how to do it, it’s easy. If you don’t, it will be the little things that trip you up. In my case, it is a buggy BIOS version. I have to reflag the BIOS boot partition each time I install another OS.

Should you want to be Crazy In Love with many different distros, you are likely to run across the issue of a mix of GRUB legacy and GRUB2. These are bootloaders–the things that make your hardware know what
software to run. There’s a leetle tiny bit of code at the beginning of each bootable hard drive that tells your machine that there’s an operating system available to run the machine. That’s the MBR–the master boot record.

I had a hellacious time figuring out why my BIOS wouldn’t find a working OS any time I installed a grub legacy OS to another partition (since grub2 was loading my Kubuntu installation). I still don’t know why chainloading grub through grub2 will NOT work with my BIOS, and chainloading grub2 through grub legacy works like a dream, but it seems like the sort of arcane knowledge only possessed by Elminster or Gandalf.

So, the recommendation from yours truly? Use a grub legacy distro to write to the MBR and use that to chainload grub2. Instructions to follow in the next post 😉

Why are we always trying to copy Windows?

There are skins for each of the OSs that aren’t Windows–to make them LOOK like Windows.

http://linux.slashdot.org/story/10/08/26/199228/Making-Ubuntu-Look-Like-Windows-7

There’s the latest; why is everyone trying so hard? There’s the usual answer; the more you make OSS look like proprietary software, the more likely that n00bs will give it a shot–but does this turn you off of the individualistic nature of OSS?