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.
2 Answers
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.

- 6,317
-
Thank you... I've made the new username and new password... I appreciate your help. – B. G. Rockey Sep 06 '16 at 03:09
-
You're welcome. If the answer worked for you, mark it as accepted if you like. ;-) – Stormlord Sep 06 '16 at 03:19
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.

- 19,395
- 12
- 50
- 65
-
1Exactly what I wanted to write in my answer! I have to add something tough: @B. G. Rockey should not forget to write the password down on paper and give it to his friend. And his friend should know how to change the password: http://askubuntu.com/questions/24006/how-do-i-reset-a-lost-administrative-password . (Just in case that he is overly cautious). – Cristiana Nicolae Sep 05 '16 at 23:51
-
Your link to creating bootable USB references
Arch
in the first paragraph. Your comment to useRufus
under Windows immediately after makes me wonder if we need clear cut instructions how to do this in Ubuntu....??? – WinEunuuchs2Unix Sep 05 '16 at 23:54 -
@WinEunuuchs2Unix For using Rufus in Windows, there are already clear (at least for me) instructions at http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-windows. – edwinksl Sep 05 '16 at 23:55
-
@Christina probably easiest just setting the password to his friend's name. Does Ubuntu allow you to have password same as User name though? Hmm.... – WinEunuuchs2Unix Sep 05 '16 at 23:57
-
1@edwinks1 that wasn't my point. Why offer someone how to do it in Windows when you are already running Ubuntu... it suggests a sense of insecurity / trepidation doing it under Ubuntu. My attempt at USB failed LOL. – WinEunuuchs2Unix Sep 05 '16 at 23:59
-
@WinEunuuchs2Unix (1st message): It doesn't matter what the ISO is, as long as it's Linux. At least, the answer applies to Ubuntu. – TheWanderer Sep 06 '16 at 00:01
-
@CristianaNicolae OP should ask their friend to provide a temp password. – TheWanderer Sep 06 '16 at 00:02
-
1@WinEunuuchs2Unix (3rd) Because using Windows and Rufus is much easier than USB burning is on Ubuntu. If there's a Windows box nearby, it's better to use it. – TheWanderer Sep 06 '16 at 00:03
-
2@WinEunuuchs2Unix Ah, that's what you meant. I think Zacharee1 is just trying to cover all bases by including Rufus in Windows. – edwinksl Sep 06 '16 at 00:04
-
I think we need a Rufus for Linux. MS is adding Linux support to Windows via Bash in Windows 10. Perhaps Wine or something can be modded to run Rufus and create bootable Ubuntu USB's in a quick, error free, relatively painless GUI. Also with a question last night to burn Dell BIOS updates in .exe file formats to USB without having to use ubootin or whatever it's called – WinEunuuchs2Unix Sep 06 '16 at 00:12
-
@WinEunuuchs2Unix good luck getting someone to port Rufus. You can try contacting the dev. – TheWanderer Sep 06 '16 at 00:18
-
@Zacharee1 Rufus was just an off-the-cuff example. It can be anyone. I did read that creating a bootable USB under Windows was different than creating a bootable USB under Linux because the boot structure was different. Still it doesn't seem like rocket science. That said I'm still struggling filing a bug report that Kernel 4.7.2 doesn't work under Ubuntu 14.04. – WinEunuuchs2Unix Sep 06 '16 at 00:20