Ubuntu – Password for live USB with persistence

live-usbmkusbpasswordpersistenceroot

I recently used @Harsh 's mkusb instructions to successfully create an Ubuntu 18.04 live USB with persistence greater than 4 GB. The default user is Ubuntu and the default password is , that is to say blank (just hit enter).

Can I run the sudo passwd Ubuntu command and add an actual password to this live USB system? I want a password required on boot and on the lock screen as well. I don't know what issues this would present, if any. I do understand somebody could still mount my live USB system on another Linux machine, and have access to my files. My password requirement is a very low level of defense, that I'm comfortable with, and want.

Alternatively, could I simply delete the Ubuntu user, and add myself jason as the only user, create a password for jason, and be done with it?

Best Answer

Persistent live Ubuntu

  • I tested, and yes, you can remove the original ubuntu user after creating a custom user ID with a good password and admin (sudo) permissions.

    sudo add-apt-repository universe
    sudo apt update
    sudo apt install gnome-system-tools
    

    and you get a convenient tool to create a custom user,

    users-admin
    

    Remember the admin (sudo) permissions!


  • It is a good idea to set the permissions of your subdirectories (in your home directory) to only allow your own user to see them. And set the permissions for the files in a corresponding way.

    cd
    find * -type d -exec chmod 700 {} \;
    find * -type f -exec chmod 600 {} \;
    

    Using * instead of . excludes the hidden directories and files from these actions.


Test:

Logging in live-only, 'Try Ubuntu', does not give direct access to files saved in Documents. but the default ubuntu live has sudo permissions, and can access these files that way.

ubuntu@ubuntu:/media/ubuntu/casper-rw/upper/home/tester$ ls -l
total 44
drwx------ 2 1000 1000 4096 Jan 24 20:28 Desktop
drwx------ 2 1000 1000 4096 Jan 24 20:58 Documents
drwx------ 2 1000 1000 4096 Jan 24 20:28 Downloads
drwx------ 2 1000 1000 4096 Jan 24 20:28 Music
drwx------ 2 1000 1000 4096 Jan 24 20:28 Pictures
drwx------ 2 1000 1000 4096 Jan 24 20:28 Public
drwx------ 2 1000 1000 4096 Jan 24 20:28 Templates
drwx------ 2 1000 1000 4096 Jan 24 20:28 Videos
-rw------- 1 1000 1000 8980 Jan 24 20:27 examples.desktop
ubuntu@ubuntu:/media/ubuntu/casper-rw/upper/home/tester$ ls -l Documents/
ls: cannot open directory 'Documents/': Permission denied
ubuntu@ubuntu:/media/ubuntu/casper-rw/upper/home/tester$ sudo ls -l Documents/
total 8
-rw-r--r-- 1 1000 1000 7 Jan 24 20:54 hej
-rw-r--r-- 1 1000 1000 6 Jan 24 20:58 hi
ubuntu@ubuntu:/media/ubuntu/casper-rw/upper/home/tester$ cat Documents/hi
cat: Documents/hi: Permission denied
ubuntu@ubuntu:/media/ubuntu/casper-rw/upper/home/tester$ sudo cat Documents/hi
hello
ubuntu@ubuntu:/media/ubuntu/casper-rw/upper/home/tester$ 

Installed Ubuntu in a USB pendrive

  • If you want security it is much better to create an installed system in your USB pendrive, installed like into an internal drive (but into a pendrive). See the instructions at the following link:

    How do I install Ubuntu to a USB key? (without using Startup Disk Creator).

  • If you wish, you can encrypt it (LVM with LUKS encryption). In that case, do it at the partitioning window during the installation.