- Three ways to lock your Ubuntu screen
- Method 1: Through the Settings Panel
- Method 2: Through keyboard shortcut
- Method 3: Through the command line
- Karim Buzdar
- The Best Linux Lockscreen
- Theming your lockscreen
- GDM Display Manager
- Editing the current theme
- Editing the font
- Editing the background
- Building & enabling
- Using your GTK Theme
- Vertex
- LightDM Display Manager
- Material
- Aether
- Litarvan
- SDDM Display Manager
- Aerial
- Deepin
- Changing your Display Manager
- Ubuntu
- Fedora
- LightDM
- Ubuntu
- Fedora
- Ubuntu
- Fedora
- Not Using a Display Manager At All
- XScreenSaver
- i3lock
- Default
- My custom wallpaper conserving script
- DevPy Newletter
- Автоматическая блокировка экрана в GNU/Linux
- Введение
- Подготовка
- Настройка
Three ways to lock your Ubuntu screen
When you have to take a break from work but do not want to end your current session, locking your computer screen is the way out. You can, of course, shut down your system and start it again when you are back, but that means you have to save all your work and open all in the same state when you need to. Why opt for this second option when your system allows you to temporarily lock your system so that unauthorized people can not access it.
In this article, we will explain three methods to lock your Ubuntu screen; through the UI, through the keyboard shortcut, and through the command line.
We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 LTS system.
Method 1: Through the Settings Panel
The UI based method to lock your Ubuntu screen is through the Settings Panel that can be accessed from the top bar of your Ubuntu desktop.
Click on the downward arrow located at the top right corner of your Ubuntu screen. This is the panel that will appear:
This panel gives you quick graphical access to many configurable system settings. You can lock your computer screen through the Lock icon, which by default is the second last icon located at the bottom on Ubuntu 18.04. As soon as you click on this icon, your computer screen will be locked.
Method 2: Through keyboard shortcut
All Ubuntu systems come with some predefined keyboard shortcuts that you can utilize in order to perform some basic system functions. Since screen locking is also a frequent operation, there is a shortcut for that too. In Ubuntu 18.04, you can use the Super+L shortcut to lock your computer screen. The Super key in the Windows button on your keyboard.
In previous versions of Ubuntu, you could use the Ctrl+Alt+L shortcut for this purpose.
You can easily view all the keyboard shortcuts from the system Settings utility.
The simplest way to access these settings is through the system Dash or the application launcher search bar as follows:
Enter relevant keywords to access keyboard shortcuts in this bar and then click the appropriate search result. Advertisement
This will open the Settings>Devices>Keyboard view as follows:
Here you can view the list of all the predefined shortcuts, edit one by clicking on it, and also create new custom shortcuts for your ease of use.
Method 3: Through the command line
There is a utility called Gnome Screensaver that lets you lock your Ubuntu screen through the command line.
Open your Ubuntu command line, the Terminal, either through the application launcher search or the Ctrl+Alt+T shortcut.
Then enter the following command as sudo in order to install the Gnome Screensaver utility:
Please note that only an authorized user can add/remove, and configure software on Ubuntu. Enter the password for sudo and the software will be installed on your system.
You can then use the following command in order to lock your Ubuntu screen:
These were the ways through which you can ensure the security of your system while you are away by locking your Ubuntu screen.
Karim Buzdar
About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn
Источник
The Best Linux Lockscreen
To be honest, the default lock screens, also known as greeters or display managers (when the lockscreen also manages the boot login), can leave looks to be desired on pretty much every Linux distribution. To fix that, we have several options — theme the lock screen you already have, change the lock screen, or login automatically and use another option such as i3lock.
This guide shows you how to change the login screen background, edit the login screen font, use a login screen gtk theme, and change your user manager. This guide has sections for most major display managers, but the GDM guide has the most detail.
Theming your lockscreen
Typically the easiest option. The options below are for a few of the most popular display managers.
GDM Display Manager
First back up the current theme:
Note: Ubuntu 17+ uses a GDM config that is different than the default setup. If the following setup does not work for you please comment and I will try to help. All of the scripts I link below work for me on a fresh Fedora 27 system.
Now you have a few options. If you simply want to change the font on your login manager or change the background, you can use my script:
Editing the current theme
Download the scripts on the DevPy GitHub: devpytech/scripts/gresource-extract. Then run ./extract.sh to extract your current theme to the «theme» folder in the same folder as the extract script.
Editing the font
Edit gnome-shell.css . Change the font to your custom font. E.g:
Editing the background
Copy a background to the theme folder. Then edit gnome-shell.css and change the #lockDialogGroup section to the filename of your image. E.g:
Building & enabling
Run the ./build.sh file from DevPy’s GitHub. This will create a .gresource file in the theme folder.
Finally, override the current gresource (make sure you have backed up the current file):
Using your GTK Theme
My favourite method is to match the GTK theme by building a gresource file.
Here are a few results for themes I have tested:
Vertex
You can build your own using my script here: devpytech/gtk-gresource.
I’ve included prebuilt gresource files for the following themes:
After a reboot the theme should show on login and lock.
LightDM Display Manager
LightDM is probably the second most popular display manager, after GDM. To install a theme, install both lightdm and lightdm-webkit2-greeter through your package manager. Then, navigate to /usr/share/lightdm-webkit/themes/ through the terminal or a root file manager and copy the theme files there. Once finished, enable the theme in your /etc/lightdm/lightdm-webkit2-greeter.conf by setting webkit-theme .
Material
Aether
Litarvan
SDDM Display Manager
SDDM is a display manager written from scratch. It’s best known for being the default with KDE Plasma 5. To install an SDDM theme, simply move it to /usr/share/sddm/themes/ , making sure that the folder name is the same as the theme name. You can enable a theme by editing /etc/sddm.conf under the [Theme] section and changing Current to the theme name.
Aerial
Aerial uses gifs on the lockscreen in the style of Apple TV screensavers.
Deepin
Changing your Display Manager
This option will change the way you login . forever. Or at least until you change back. Once you have installed a display manager, the way you change to it depends on your linux distribution. On Ubuntu, run » sudo dpkg-reconfigure gdm3 » replacing gdm3 with the current display manager.
You can install GDM with the following:
Ubuntu
Fedora
On other distributions, try searching gdm in the package manager.
LightDM
You can install GDM with the following:
Ubuntu
Fedora
On other distributions, try searching lightdm in the package manager.
You can install SDDM with the following:
Ubuntu
Fedora
On other distributions, try searching sddm in the package manager.
Not Using a Display Manager At All
If you like to login with the console, you can simply disable the Display Manager services:
If you use this option, I suggest that you install a screenlocker / screensaver to help avoid screwing up your monitor (keeping the same image on the monitor for a long time can freeze some pixels).
XScreenSaver
XScreenSaver ships with most distributions, but if you don’t have it, instructions can be found here. Theming is rather rudimentary but you can change the colours by editing
i3lock
Probably my favourite screen locker, i3lock is simple and has many derivations to choose from. My favourite derivation is i3lock-colors to customize the look and image.
Default
My custom wallpaper conserving script
And that’s it! If you want to go back to the defaults, simply re-enable GDM or LightDM.
Thanks for reading. Feel free to share your custom login setup in the comments below.
While Linux gaming has steadily evolved over the years, the number of titles on Windows far outnumbers the amount on [. ]
Distro agnostic installation of packages is a long time coming. There are literally thousands of different distros, and a fair [. ]
DevPy Newletter
We don’t spam, and we only send emails once or twice a week month.
Источник
Автоматическая блокировка экрана в GNU/Linux
Часто ли уходя за очередной чашечкой кофе или выйдя из кабинета/офиса совершить личный звонок, ты ловишь себя на мысли что забыл заблокировать экран своего компьютера? А на компьютере в это время осталась открытая переписка в Skype/почте или еще хуже — сессия root’а в консоли? В результате ты стараешься вернуться к своему компьютеру как можно быстрее, чтобы добрые коллеги не успели поставить фоном рабочего стола обои с Черным Властелином.
В данной статье приведу пример решения этой проблемы с блокировкой экрана, которое поможет закрыть доступ к рабочему столу в тот момент когда ты отойдешь от компьютера.
Введение
Опишу вкратце предлагаемое решение, для понимания того что мы будем сейчас делать. Сделаем так что операционная система будет сама, средствами Bluetooth, проверять как далеко находится пользователь, и в случае «недосягаемости» будет автоматически блокировать экран. Процесс снятия блокировки останется на совести пользователя, и будет заключаться в вводе пароля, который используется в его учетной записи. Автоматически снимать блокировку довольно рискованная затея поэтому данный сценарий рассматривать не будем. По уровню сложности данная статья ориентирована на продвинутых пользователей Linux, т.к. некоторые этапы настройки будут описаны без лишних деталей, полагаясь на очевидность, чтобы не уходить в сторону от основной освещаемой темы.
Подготовка
Для начала необходимо убедиться что наш компьютер и мобильный телефон поддерживают технологию Bluetooth. Если с мобильным телефон проблем не должно возникнуть, т.к. большинство современных аппаратов имеют поддержку «синего зуба», то с компьютером вполне могут. Не буду подробно рассказывать как настроить Bluetooth в разных дистрибутивах Linux, а просто опишу основные этапы настройки поддержки оного, при условии что аппаратная часть включает в себя необходимые компоненты, на примере Gentoo.
Основные этапы настройки поддержки Bluetooth в Linux
- Включить в BIOS поддержку Bluetooth, если это контролируется отдельным параметром, например как на ноутбуках Lenovo
- Определить какой bluetooth-контроллер используется в конфигурации компьютера:
- Включить в ядре поддержку подсистемы Bluetooth и необходимый драйвер для вашего контроллера:
- Сохранить конфигурацию, установить обновленное ядро и его модули, после чего перезагрузить систему для загрузки с новым ядром
- Установить пакет Bluez (с поддержкой test-programs), который будет выполнять работу на программном уровне. В пакетной базе Gentoo он выглядит так:
- Под пользователем с правами root-а запустить демон bluetooth и добавить его в автозагрузку системы:
- Проверить что bluetooth-устройство определилось и готово к работе:
На этом подготовка завершена, переходим к следующему этапу.
Настройка
В данном разделе будет вся суть решения, а именно мы настроим сопряжение между мобильным телефоном и компьютером. После чего в операционной системе подготовим скрипт проверки доступности телефона по каналу Bluetooth, который будет вызываться каждую минуту средствами демона-планировщика Cron. Приступим.
- Включить bluetooth на телефоне и настроить его видимость для остальных участников сети:
- На стороне компьютера запустить сканирование сети bluetooth, в результате чего мы определим адрес нашего мобильного телефона (можно подсмотреть на самом телефоне):
- Настроить сопряжение, на телефоне принять входящее подключение:
- Добавить адрес мобильного телефона в список доверенных устройств:
- Проверить доступность телефона с компьютера по bluetooth:
- Отключить видимость в настройках bluetooth мобильного телефона, если это не произошло автоматически:
- Подготовить скрипт, который будет проверять доступность телефона и в случае недоступности блокировать экран:
В моем случае:
= 00:AA:70:31:9A:19
= не root-пользователь, под которым запускаются X и вся остальная основная работа в системе
= я использую пакет gnome-extra/gnome-screensaver из окружения Gnome без всей остальной среды, поэтому команда блокировки экрана выглядит так — gnome-screensaver-command —lock - Выполнить тестовую проверку под root-ом при включенном на телефоне bluetooth
- Отключить bluetooth на телефоне и повторно выполнить проверку, тоже с правами root-а
- Добавить ежеминутное правило в crontab:Если пугают такие правила в crontab, то можно проверку вынести в отдельный скрипт в каталоге /usr/local/sbin, c более хитрыми проверками, который потом указать в правиле crontab.
На этом настройка и проверка завершены.
Источник