Automatically start scripts/applications on tails bootup
There could be a need for several scripts to run each time Tails boots up, so this is a mechanism for doing so.
-
Make sure you have dotfiles feature turned on in your persistence configuration.
-
Download and unpack asset files:
cd ~/Downloads wget https://raw.githubusercontent.com/dutu/tails-autostart/master/assets/tails-autostart.tar.gz tar -xzvf tails-autostart.tar.gz
-
Run the installation script:
cd tails-autostart chmod +x install_tails_autostart.sh sudo ./install_tails_autostart.sh
Done.
- add any scripts to
/live/persistence/TailsData_unlocked/dotfiles/.config/autostart/amnesia.d
to execute them on startup as amnesia - add any scripts to
/live/persistence/TailsData_unlocked/dotfiles/.config/autostart/root.d
to execute them on startup as root
run_dir_scripts.sh
runs all the scripts ending in .sh
in a particular directory. This way, we use the same script to run amnesia.d
scripts and root.d
scripts.
startup_mods.sh
runs run_dir_scripts.sh
for each user (root and amnesia). running as root is done using pkexec
(gui for sudo prompt).
Finally, using Gnome's autostart feature, Tails-autostart.desktop
is run each time Gnome starts up. This Tails-autostart.desktop
runs /live/persistence/TailsData_unlocked/tails-autostart/startup_mods.sh
So on startup, gnome runs:
graph LR;
A(Tails-autostart.desktop)-->B(startup_mods.sh);
B(startup_mods.sh)-->C(pkexec run_dir_scripts.sh);
B(startup_mods.sh)-->D(run_dir_scripts.sh);
C(pkexec run_dir_scripts.sh)-->E(root.d/*.sh);
D(run_dir_scripts.sh)-->F(amnesia/*.sh);
Note:
startup_mods.sh
now checks for.sh
script files in.config/autostart/root.d
. If no files are found,pkexec
is not executed. This is to avoid unnecessary prompt to enter admin password after Gnome starts up.
- Remove Tails-autostart files:
rm /live/persistence/TailsData_unlocked/dotfiles/.config/autostart/Tails-autostart.desktop rm -fr /live/persistence/TailsData_unlocked/dotfiles/.config/autostart/Tails-autostart
Note: Scripts in
autostart/amnesia.d
andautostart/root.d
intended to run on startup will remain in place. However, with the removal of Tails autostart, they will no longer be triggered at Tails startup.