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
  • Welcome, you can try making an image of the disk, with clonezilla for example, and clone it to you new machine, but this isn't a sure thing. – schrodingerscatcuriosity Feb 25 '21 at 13:09
  • 1
    I would think that most of the stuff you want to delete, would be in your home directory. Go to /Other Locations/computer/home/[Your Name] and save the folder someplace secure (preferably usin Rsync or GRsync. Then you can delete the /[Your Name] folder from the computer. Until the files are overwritten, they can be recovered using special software, but not something your successor is likely to do. (Unless he is working for the FBI). – C.S.Cameron Feb 25 '21 at 13:29

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
  • 26,947
  • Okay, this is probably the way. But is there an application which I could use for this? It's not that I am not familiar with terminal, but there are some folders in $HOME which shouldn't be deleted. Like folder containing project I was working on, that same project new guy will continue working on – nikname Feb 25 '21 at 13:22
  • copy/backup the projects manually. – pLumo Feb 25 '21 at 13:24
  • Why not use a a tool like LXD to just create a sandboxed ubuntu instance for people to play with then when its finished delete it.? – Simon Banks Feb 25 '21 at 14:05
  • What you mean when finished? OP is finished, but he did not have a sandboxed Ubuntu. Did you read the Question? – pLumo Feb 25 '21 at 14:06
  • @pLumo yep, that's right. I didn't tought anyone will continue using this laptop, but it is how it is – nikname Feb 25 '21 at 14:42