1

I am currently using Ubuntu 16.04. A friend wants to buy my computer with Ubuntu ready for him for himself. How do I wipe the system of my 'stuff' and set up like new for him? My system has 2 hard drives.

lambda23
  • 3,362

2 Answers2

6

This method will help you remove your account and home folder without reinstalling the whole system but it will leave any additional software you've installed intact. If you want that software removed too you have to either purge it manually or do a clean install.

Start your system as usual, open a terminal and type: sudo passwd.
This will let you create a password for the root user. Right after that, log off your account and when the lightdm screen reappears asking for your password, press Ctrl-Alt-F1 to go to console mode.

In console mode you will be asked to enter the user name first. Type root+Enter. Then type the password you created a few minutes ago for the root user.

As root now, type service lightdm stop to stop the display manager.

Type deluser --remove-home your_existing_username to completely delete both your user and your home folder from the system. This will also remove the group with your username.

Type adduser your_friend's_username to create the account for the new user. You will be asked for a new password for this account which you must provide. You can also provide a real name and surname if you want. For the rest of the questions asked, you can just press Enter.

Type sync && sleep 1; reboot to restart the system. You can just use reboot if you like but I prefer the first way just to make sure everything is synced before restarting.

The system will restart and you will see the new account waiting for a password. Your existing account and data will all be gone.

Stormlord
  • 6,807
3

Reinstall the OS. Download the Ubuntu ISO from the website, burn it to a USB stick/DVD and boot from it.

In the installer, choose Erase disk and install Ubuntu when prompted.

We have instructions for making bootable USB drives on Ubuntu: Help with creating bootable usb from iso. You can also use Rufus if you have Windows available.

As for the second drive, before you start the installation, go into the Live Environment (Try Ubuntu option) and open Gparted. Select the second drive in the dropdown on the top right and unmount (if any are mounted) and delete all the partitions. Then, create a new ext4 or NTFS (for dual-OS data) partition.

That should be all you need. Tell me if you need any clarification.

TheWanderer
  • 19,525
  • 12
  • 52
  • 65