linux:systemd:auto-lock_the_computer_on_a_schedule_e.g._at_bedtime
Linux - systemd - Auto-lock the computer on a schedule (e.g. at bedtime)
- ~/.config/systemd/user/lock-session-bedtime.service
[Unit] Description=Lock session [Service] Type=simple ExecStart=/usr/bin/loginctl lock-session [Install] WantedBy=default.target
NOTE: Create the folder if it does not exist.
- ~/.config/systemd/user/lock-session-bedtime.timer
[Unit] Description=Lock session at night [Timer] OnCalendar=23:45 Unit=lock-session-bedtime.service [Install] WantedBy=default.target
NOTE: Modify the log out time as needed.
Take care not to make any other changes to the file.
Run
systemd --user daemon-reload systemd --user enable --now \ lock-session-bedtime.timer
NOTE: The scheduled time can be modified by editing modifying the timer file.
This can be removed by deleting the timer and service files.
linux/systemd/auto-lock_the_computer_on_a_schedule_e.g._at_bedtime.txt · Last modified: 2023/07/17 14:21 by peter