1

I have been working on a laptop which has Ubuntu 18.04 for OS for couple of years. During that period, I have been also using that same laptop for personal things, had installed Viber and couple of other applications which stored data on the system, containing photos, messages and other things that I would not like to leave on a system before passing laptop to a new user. And since I am moving from this job, someone will continue working on the laptop I was using.

Now, I know that clean install would be the best option, but the problem is that there are programs, data and connection with github, that are needed for working and after clean install I would have to install all of them after clean install, and I would like to avoid it if it is possible to clean existing Ubuntu system some other way.

Please suggest me which applications should I be using for this purpose?

nikname
  • 13

1 Answers1

2

Usually, all your personal files are inside your $HOME. So, you should create a second admin user. From this one, copy over everything you want to keep or better create a backup from your old $HOME, so you can recreate important things later and you don't miss anything.

Check in other locations like /tmp or /var if there are any personal files or logs. It should be safe to remove /var/logs/*.

You could use find to find files that belong to the old user in locations outside of $HOME:

sudo find / -xdev -path "/home/old_user" -prune -o -user old_user

Then remove your old user and your complete $HOME directory.

sudo deluser --remove-home old_user_name

When you are done with that, you need to wipe all empty space.

You can use sfill from secure-delete to wipe all empty space on your hard drive.

sudo apt-get install secure-delete

sfill will default to run multiple passes with /dev/random, which is super-paranoid. If your enemy is not the NSA, one-time filling with zeros is enough:

sfill -l -l -z /home/new_user/

... or overwrite the space yourself by creating a big empty file and when all space is filled, delete it:

cat /dev/zero > zero.file
sync
rm zero.file

If for some reason, your user should be kept, you need to remove your personal files manually before wiping empty space. Be aware that you have config, keyring files, temp files, logs, thumbails in various locations and you will likely miss some of them. You can use bleachbit to help you with this, but I would still always prefer creating a new user and deleting the old one.


If you want to make sure, run photorec on your hard drive to check if there is anything that a new user could possibly see:

sudo apt install testdisk
sudo photorec /dev/sda1

(replace /dev/sda1 with your actual hard drive location).

Depending on the size of your disk, this will take a while.

pLumo
  • 27,991