Unknown username and password on secondhand laptop

Ive just bought a laptop in car-boot, they said its Linux, i ask the seller if there is password, but when i open it at home there is a username and password to fill in, how can i log on to it?

Erm, you can’t… well you can but it’s intentionally difficult… it would probably be MUCH easier (if you’ve never used Linux before) to wipe the drive and reinstall (see the bottom section of this posting).

To change a “user” password

First you’re going to require a Linux LiveCD (use Ubuntu).

Then you’re going to need to boot to the LiveCD, open a terminal and enter:

sudo fdisk -l

and try to work out which is the correct partition to attach to with chroot

this will usually but not always be /dev/sda1

Once you know that, you’ll need to run:

sudo mkdir /mnt/temp-chroot
sudo mount /dev/sda1 /mnt/temp-chroot
sudo mount -t proc none /mnt/temp-chroot/proc
sudo chroot /mnt/temp-chroot

Then run the following command to list the user accounts

grep home /etc/passwd|cut -d ":" -f1

look for an obvious username.

Once you know a username

sudo passwd <username>

You’ll be asked for your new password twice.

then unmount with:

sudo umount /mnt/temp-chroot/proc
sudo umount /mnt/temp-chroot

Then reboot to the hard drive, and use the username you discovered earlier, and the new password you entered.

There’s always the chance that this won’t work, depending on the Linux distrribution.

It would be MUCH easier to download an Ubuntu LiveCD ISO image from here:

Burn it to a CDR/DVD-R

Boot to it… and tell it to wipe the drive and install Ubuntu in its place.

If you require further instructions, just ask… it may also help if you posted anything else you can tell us, such as the make/model of the laptop, and if you know which Linux distribution/version is installed.