Merge branch 'master' of github.com:arcan1s/arcan1s.github.io

This commit is contained in:
arcan1s 2014-12-20 01:25:41 +03:00
commit 63df581d00
10 changed files with 648 additions and 35 deletions

View File

@ -49,7 +49,7 @@ layout: default
<section>
<h1><a href="#" class="anchor" id="title"><span class="octicon octicon-link"></span></a>{{ page.title }}</h1>
{{ page.description }}
<p>{{ page.description }}</p>
<br>
{{ content }}

View File

@ -0,0 +1,173 @@
---
category: en
type: paper
hastr: true
layout: paper
tags: linux, systemd, ecryptfs
title: How to encrypt home directory. For dummies
short: ecnryption-home-directory
description: <figure class="img"><img src="/resources/papers/single-door.jpg" alt="single-door"></figure>This paper is about encryption home directory using ecryptfs and automount settins using systemd and key on flash card.
---
<h2><a href="#preparation" class="anchor" id="preparation"><span class="octicon octicon-link"></span></a>Step 0: Preparation</h2>
<ol>
<li>Logout as user.</li>
<li>Login as root on tty. The following actions should be done as root.</li>
<li>Move your home directory and create empty directory (<code>s/$USER/user name/</code>):
{% highlight bash %}
mv /home/{$USER,$USER-org}
mkdir /home/$USER
chmod 700 /home/$USER
chown $USER:users /home/$USER
{% endhighlight %}
</li>
</ol>
<h2><a href="#step1" class="anchor" id="step1"><span class="octicon octicon-link"></span></a>Step 1: Encryption</h2>
<p>The widespread solution in the Internet is to use automatic utilities to do it. However in our case they are not suitable, since we need to import key / password signature, which is not possible in this case.</p>
<p>The encryption can be done by the following command (lol):</p>
{% highlight bash %}
mount -t ecryptfs /home/$USER /home/$USER
{% endhighlight %}
<p>While process it asks some question (I suggest to do first mounting in the interactive mode). The answers may be like following (see the comments),
please note that if you change something, it will be changed in some lines below too:</p>
{% highlight bash %}
# key or certificate. The second one is more reliable while you don't lose it %)
Select key type to use for newly created files:
1) passphrase
2) openssl
Selection: 1
# password
Passphrase:
# cipher, select default
Select cipher:
1) aes: blocksize = 16; min keysize = 16; max keysize = 32
2) blowfish: blocksize = 8; min keysize = 16; max keysize = 56
3) des3_ede: blocksize = 8; min keysize = 24; max keysize = 24
4) twofish: blocksize = 16; min keysize = 16; max keysize = 32
5) cast6: blocksize = 16; min keysize = 16; max keysize = 32
6) cast5: blocksize = 8; min keysize = 5; max keysize = 16
Selection [aes]: 1
# key size, select default
Select key bytes:
1) 16
2) 32
3) 24
Selection [16]: 1
# enable reading/writing to the non-encrypted files
Enable plaintext passthrough (y/n) [n]: n
# enable filename encryption
Enable filename encryption (y/n) [n]: y
Filename Encryption Key (FNEK) Signature [XXXXX]:
# toolongdontread
Attempting to mount with the following options:
ecryptfs_unlink_sigs
ecryptfs_fnek_sig=XXXXX
ecryptfs_key_bytes=16
ecryptfs_cipher=aes
ecryptfs_sig=XXXXX
WARNING: Based on the contents of [/root/.ecryptfs/sig-cache.txt],
it looks like you have never mounted with this key
before. This could mean that you have typed your
passphrase wrong.
# accept, quit
Would you like to proceed with the mount (yes/no)? : yes
Would you like to append sig [XXXXX] to
[/root/.ecryptfs/sig-cache.txt]
in order to avoid this warning in the future (yes/no)? : yes
Successfully appended new sig to user sig cache file
Mounted eCryptfs
{% endhighlight %}
<p>Then copy files from home directory to encrypted one:</p>
{% highlight bash %}
cp -a /home/$USER-org/. /home/$USER
{% endhighlight %}
<h2><a href="#step2" class="anchor" id="step2"><span class="octicon octicon-link"></span></a>Step 2: systemd automounting</h2>
<p>Create file on flash card (I've used microSD) with the following text (you should insert your password):</p>
{% highlight bash %}
passphrase_passwd=someverystronguniqpassword
{% endhighlight %}
<p>Add card automount (mount point is <code>/mnt/key</code>) to <code>fstab</code> with option <code>ro</code>, for example:</p>
{% highlight bash %}
UUID=dc3ecb41-bc40-400a-b6bf-65c5beeb01d7 /mnt/key ext2 ro,defaults 0 0
{% endhighlight %}
<p>Let's configure home directory mounting. The mount options can be found in the following output:</p>
{% highlight bash %}
mount | grep ecryptfs
{% endhighlight %}
<p>I should note that there are not all options there, you need add <code>key</code>, <code>no_sig_cache</code>, <code>ecryptfs_passthrough</code> too. Thus systemd mount-unit should be like the following (if you are systemd-hater you can write the own daemon, because it doesn't work over <code>fstab</code> without modification (see below)).</p>
{% highlight bash %}
# cat /etc/systemd/system/home-$USER.mount
[Unit]
Before=local-fs.target
After=mnt-key.mount
[Mount]
What=/home/$USER
Where=/home/$USER
Type=ecryptfs
Options=rw,nosuid,nodev,relatime,key=passphrase:passphrase_passwd_file=/mnt/key/keyfile,no_sig_cache,ecryptfs_fnek_sig=XXXXX,ecryptfs_sig=XXXXX,ecryptfs_cipher=aes,ecryptfs_key_bytes=16,ecryptfs_passthrough=n,ecryptfs_unlink_sigs
[Install]
WantedBy=local-fs.target
{% endhighlight %}
<p><code>XXXXX</code> should be replaced to signature from options with which directory are currently mounting. Also you need to insert user name and edit path to file with password (and unit name) if it is needed. Autoload:</p>
{% highlight bash %}
systemctl enable home-$USER.mount
{% endhighlight %}
<p>Here is a service to unmount flash card when it will be unneeded:</p>
{% highlight bash %}
# cat /etc/systemd/system/umount-key.service
[Unit]
Description=Unmount key card
Before=local-fs.target
After=home-arcanis.mount
[Service]
Type=oneshot
ExecStart=/usr/bin/umount /mnt/key
[Install]
WantedBy=local-fs.target
{% endhighlight %}
<p>Enable:</p>
{% highlight bash %}
systemctl enable umount-key.service
{% endhighlight %}
<p>Reboot. Remove backups if all is ok. If not then you did a mistake, resurrect system from emergency mode.</p>
<h2><a href="#whynotfstab" class="anchor" id="whynotfstab"><span class="octicon octicon-link"></span></a>Why not fstab?</h2>
<p>In my case I could not to make flash mounting before home decryption. Thus I saw emergency mode on load in which I should just continue loading. There are two solutions in the Internet:</p>
<ul>
<li>Create entry with noauto option and then mount using the special command in <code>rc.local</code>.</li>
<li>Create entry with nofail option and then remount all partitions in <code>rc.local</code>.</li>
</ul>
<p>In my opinion both of them are workarounds too much.</p>
<h2><a href="#whynotpam" class="anchor" id="whynotpam"><span class="octicon octicon-link"></span></a>Why not pam?</h2>
<p>Other solution is to mount using pam entry. In my case I have authentication without password on fingerprint so it doesn't work for me.</p>

View File

@ -0,0 +1,138 @@
---
category: en
type: paper
hastr: true
layout: paper
tags: awesome-widgets, pytextmonitor
title: Awesome Widgets 2.1 - bells and whistles
short: aw-v21-bells-and-whistles
description: The paper deals with settings of a custom scripts and graphical bars in the new version of Awesome Widgets (2.1).
---
<h2><a href="#intro" class="anchor" id="intro"><span class="octicon octicon-link"></span></a>Introduction</h2>
<p>For a start it is highly recommended copy file <code>$HOME/.kde4/share/config/extsysmon.conf</code> after widget update before you open widget settings, because old and new script settings are incompatible. Also I should note that these features can be configured from graphical interface, but I will describe how it can be done by simply editing the desktop file.</p>
<h2><a href="#bars" class="anchor" id="bars"><span class="octicon octicon-link"></span></a>Bars</h2>
<p>Bars are stored in the two directories: <code>/usr/share/apps/plasma_applet_awesome-widget/desktops/</code> and <code>$HOME/.kde4/share/apps/plasma_applet_awesome-widget/desktops/</code> (path may be differ in depend from your distro). Settings in the home directory have a higher priority that global ones. Configuration files have the following fields:</p>
<table>
<tr>
<th>Field</th>
<th>Required</th>
<th>Value</th>
<th>Default</th>
</tr>
<tr>
<th>Name</th>
<td>yes</td>
<td>bar name. It should be as <code>barN</code> and should be unique</td>
<td>none</td>
</tr>
<tr>
<th>Comment</th>
<td>no</td>
<td>comment</td>
<td>empty</td>
</tr>
<tr>
<th>X-AW-Value</th>
<td>yes</td>
<td>bar value. The following tags are available <code>cpu*</code>, <code>gpu</code>, <code>mem</code>, <code>swap</code>, <code>hdd*</code>, <code>bat</code></td>
<td>cpu</td>
</tr>
<tr>
<th>X-AW-ActiveColor</th>
<td>yes</td>
<td>active part fill in format <code>R,G,B,A</code></td>
<td>0,0,0,130</td>
</tr>
<tr>
<th>X-AW-InactiveColor</th>
<td>yes</td>
<td>inactive part fill in format <code>R,G,B,A</code></td>
<td>255,255,255,130</td>
</tr>
<tr>
<th>X-AW-Type</th>
<td>yes</td>
<td>bar type. The following types are supported <code>Horizontal</code>, <code>Vertical</code>, <code>Circle</code></td>
<td>Horizontal</td>
</tr>
<tr>
<th>X-AW-Direction</th>
<td>yes</td>
<td>the fill direction. The following variants are supported <code>LeftToRight</code>, <code>RightToLeft</code></td>
<td>LeftToRight</td>
</tr>
<tr>
<th>X-AW-Height</th>
<td>yes</td>
<td>height, pixels</td>
<td>100</td>
</tr>
<tr>
<th>X-AW-Width</th>
<td>yes</td>
<td>width, pixels</td>
<td>100</td>
</tr>
</table>
<h2><a href="#scripts" class="anchor" id="scripts"><span class="octicon octicon-link"></span></a>Scripts</h2>
<p>Scripts are stored in the two directories: <code>/usr/share/apps/plasma_engine_extsysmon/scripts/</code> and <code>$HOME/.kde4/share/apps/plasma_engine_extsysmon/scripts/</code> (path may be differ in depend from your distro). Settings in the home directory have a higher priority that global ones. To enable script you should type it on the output field. Configuration files have the following fields:</p>
<table>
<tr>
<th>Field</th>
<th>Required</th>
<th>Value</th>
<th>Default</th>
</tr>
<tr>
<th>Name</th>
<td>yes</td>
<td>script name</td>
<td>none</td>
</tr>
<tr>
<th>Comment</th>
<td>no</td>
<td>comment</td>
<td>empty</td>
</tr>
<tr>
<th>Exec</th>
<td>yes</td>
<td>path to executable file</td>
<td>/usr/bin/true</td>
</tr>
<tr>
<th>X-AW-Prefix</th>
<td>no</td>
<td>prefix to executable file. Usually it's not required, but in other you may want to specify interpretor for example.</td>
<td></td>
</tr>
<tr>
<th>X-AW-Active</th>
<td>no</td>
<td>whether or not the script is active</td>
<td>true</td>
</tr>
<tr>
<th>X-AW-Output</th>
<td>no</td>
<td>whether or not the script has output to console. You may set it to <code>false</code> if you want use the script as cron jobs</td>
<td>true</td>
</tr>
<tr>
<th>X-AW-Redirect</th>
<td>no</td>
<td>stream redirection. The following variants are available <code>stderr2stdout</code>, <code>nothing</code>, <code>stdout2stderr</code>. stderr will be enabled, if you run application with <code>DEBUG=yes</code></td>
<td>nothing</td>
</tr>
<tr>
<th>X-AW-Interval</th>
<td>no</td>
<td>update interval in standard widget intervals</td>
<td>1</td>
</tr>
</table>

View File

@ -23,6 +23,6 @@ hastr: true
<a href="{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a>
</h2>
<p><i>{{ post.date | date_to_string }}</i></p>
{{ post.description }}
<p>{{ post.description }}</p>
<p><b>Tags</b>: {{ post.tags }}</p>
{% endfor %}

View File

@ -87,7 +87,7 @@ sudo make install
<!-- howto block -->
<h2><a href="#howto" class="anchor" id="howto"><span class="octicon octicon-link"></span></a>How to use</h2>
<p>Open your Plasma widgetes and select <code>Awesome Widget</code>.</p>
<p>Open your Plasma widgets and select <code>Awesome Widget</code>.</p>
<h3><a href="#tips" class="anchor" id="tips"><span class="octicon octicon-link"></span></a>Tips & tricks</h3>
<p>You may use different colors for labels. Just put label text into html code. See <a href="https://github.com/arcan1s/awesome-widgets/issues/9" title="GitHub">issue</a> for more details.</p>
@ -107,14 +107,6 @@ sudo make install
<th>ACPIPATH</th>
<td>Path to ACPI devices. Default is <code>/sys/class/power_supply/</code>.</td>
</tr>
<tr>
<th>CUSTOM</th>
<td>Custom commands to run. Default is <code>wget -qO- http://ifconfig.me/ip</code>. Separator is <code>@@</code>.</td>
</tr>
<tr>
<th>DESKTOPCMD</th>
<td>Command which defines the current desktop. Default is <code>qdbus org.kde.kwin /KWin currentDesktop</code>.</td>
</tr>
<tr>
<th>GPUDEV</th>
<td>Set GPU device. May be <code>nvidia</code> (for nVidia), <code>ati</code> (for ATI Radeon), <code>disable</code> or <code>auto</code>. Default is <code>auto</code>.</td>
@ -534,16 +526,14 @@ sudo make install
<p><b>AC offline tag:</b> Line which will be shown when AC is offline. Default is <code>( )</code>.</p>
<p><b>Check updates:</b> Check updates on load. Default is <code>true</code>.</p>
<h4><a href="#tooltips" class="anchor" id="tooltips"><span class="octicon octicon-link"></span></a>Tooltips</h4>
<p>Since version 1.7.0 CPU, CPU clock, memory, swap, network and battery support graphical tooltip. To enable them just make the needed checkboxes a fully checked. The number of stored values can be set in the tab. Colors of graphs are configurable too.</p>
<h4><a href="#deguiconf" class="anchor" id="deguiconf"><span class="octicon octicon-link"></span></a>DataEngine settings</h4>
<p><b>ACPI path:</b> Path to ACPI devices. The file <code>/sys/class/power_supply/</code>.</p>
<p><b>Custom command:</b> Commands, which will be run for custom label. For example, <code>wget -qO- http://ifconfig.me/ip</code> will return external IP.</p>
<p><b>Desktop cmd:</b> Type a command which will be run for desktop DataEngine. Default is <code>qdbus org.kde.kwin /KWin currentDesktop</code>.</p>
<p><b>GPU device:</b> Select one of supported GPU devices. <code>auto</code> will enable auto selection, <code>disable</code> will disable all GPU monitors. Default is <code>auto</code>.</p>
<p><b>HDD:</b> Select one of HDDs for HDD temperature monitor. <code>all</code> will enable monitor for all devices, <code>disable</code> will disable HDD temperature monitor. Default is <code>all</code>.</p>
@ -605,7 +595,11 @@ sudo make install
<p><b>Vertical layout:</b> Use vertical layout instead of horizontal one.</p>
<p><b>Add stretch:</b> Add stretch (spacer) to the selected side of the widget.</p>
<p><b>Enable tooltip:</b> Check to enable preview on selected destkop. Default is <code>true</code>. Also you show specify type of preview, default is <code>Windows</code>.</p>
<p><b>Tooltip width:</b> Using tooltip width in px. Default is <code>200px</code>.</p>
<p><b>Color of window borders:</b> Color of window contours which are used in "Contours preview". Default is <code>#ffffff</code>.</p>
<p><b>Mark:</b> Type symbol (or string) which will be shown if this desktop is active now.</p>
@ -615,6 +609,10 @@ sudo make install
<td><code>$mark</code></td>
<td>Show mark if this desktop is active.</td>
</tr>
<tr>
<td><code>$fullmark</code></td>
<td>The same as <code>$mark</code>, but shows empty space too.</td>
</tr>
<tr>
<td><code>$name</code></td>
<td>Name of the desktop.</td>
@ -629,8 +627,6 @@ sudo make install
</tr>
</table>
<p><b>Command:</b> Type command which will be run on left click on the selected desktop. Available variables are same as for pattern. Default is <code>dbus org.kde.kwin /KWin setCurrentDesktop $number</code>.</p>
<p><b>Panel toggle:</b> Select panels which will be set hidden on hotkey.</p>
<!-- end of config block -->

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -0,0 +1,172 @@
---
category: ru
type: paper
hastr: true
layout: paper
tags: linux, systemd, ecryptfs
title: Как зашифровать хомяк и не об%$#аться. For dummies
short: ecnryption-home-directory
description: <figure class="img"><img src="/resources/papers/single-door.jpg" alt="single-door"></figure>Статья посвящена шифрованию домашнего каталога с использованием ecryptfs и настройке автомонтирования посредством systemd с использованием ключа на флешке.
---
<h2><a href="#preparation" class="anchor" id="preparation"><span class="octicon octicon-link"></span></a>Шаг 0: Подготовка</h2>
<ol>
<li>Разлогинились пользователем. То есть совсем-совсем.</li>
<li>Зашли под root в tty. Дальнейшие действия описаны от него.</li>
<li>Передвинули наш хомяк и создали пустую директорию (<code>s/$USER/имя пользователя/</code>):
{% highlight bash %}
mv /home/{$USER,$USER-org}
mkdir /home/$USER
chmod 700 /home/$USER
chown $USER:users /home/$USER
{% endhighlight %}
</li>
</ol>
<h2><a href="#step1" class="anchor" id="step1"><span class="octicon octicon-link"></span></a>Шаг 1: Шифрование</h2>
<p>Самое распространенное решение в интернетах - воспользоваться автоматическими тулзами. Однако в нашем случае они не подходят, так как нам необходимо импортировать сигнатуру ключа / пароля, что при данном решении невозможно (или у автора руки кривые).</p>
<p>Делается шифрование следующим образом (lol):</p>
{% highlight bash %}
mount -t ecryptfs /home/$USER /home/$USER
{% endhighlight %}
<p>В процессе он у нас задаст несколько вопросов (я предлагаю первое монтирование делать в интерактивном режиме). Ответы можно взять примерно такие (в комментариях показано, что эти опции делают), обратите внимание, что если вы что то измените, то изменится и некоторые строчки далее:</p>
{% highlight bash %}
# ключ или сертификат. Второе надежнее, но до тех пор пока не потеряете %)
Select key type to use for newly created files:
1) passphrase
2) openssl
Selection: 1
# пароль
Passphrase:
# шифрование, ставим берем дефолт
Select cipher:
1) aes: blocksize = 16; min keysize = 16; max keysize = 32
2) blowfish: blocksize = 8; min keysize = 16; max keysize = 56
3) des3_ede: blocksize = 8; min keysize = 24; max keysize = 24
4) twofish: blocksize = 16; min keysize = 16; max keysize = 32
5) cast6: blocksize = 16; min keysize = 16; max keysize = 32
6) cast5: blocksize = 8; min keysize = 5; max keysize = 16
Selection [aes]: 1
# размер ключа, берем дефолт
Select key bytes:
1) 16
2) 32
3) 24
Selection [16]: 1
# разрешать читать/писать в нешифрованные файлы в точке монтирования
Enable plaintext passthrough (y/n) [n]: n
# включить шифрование имен файлов
Enable filename encryption (y/n) [n]: y
Filename Encryption Key (FNEK) Signature [360d0573e701851e]:
# многабукафниасилил
Attempting to mount with the following options:
ecryptfs_unlink_sigs
ecryptfs_fnek_sig=360d0573e701851e
ecryptfs_key_bytes=16
ecryptfs_cipher=aes
ecryptfs_sig=360d0573e701851e
WARNING: Based on the contents of [/root/.ecryptfs/sig-cache.txt],
it looks like you have never mounted with this key
before. This could mean that you have typed your
passphrase wrong.
# подтверждаем, выходим
Would you like to proceed with the mount (yes/no)? : yes
Would you like to append sig [360d0573e701851e] to
[/root/.ecryptfs/sig-cache.txt]
in order to avoid this warning in the future (yes/no)? : yes
Successfully appended new sig to user sig cache file
Mounted eCryptfs
{% endhighlight %}
<p>Далее просто копируем файлы из родного хомяка:</p>
{% highlight bash %}
cp -a /home/$USER-org/. /home/$USER
{% endhighlight %}
<h2><a href="#step2" class="anchor" id="step2"><span class="octicon octicon-link"></span></a>Шаг 2: Автомонтирование с systemd</h2>
<p>Создадим файл на флешке (я использовал microSD) со следующим содержанием (пароль только поставьте свой):</p>
{% highlight bash %}
passphrase_passwd=someverystronguniqpassword
{% endhighlight %}
<p>Добавим автомонтирование флешки (направление <code>/mnt/key</code>) в <code>fstab</code> с опцией <code>ro</code>, например так:</p>
{% highlight bash %}
UUID=dc3ecb41-bc40-400a-b6bf-65c5beeb01d7 /mnt/key ext2 ro,defaults 0 0
{% endhighlight %}
<p>Теперь настроим монтирование хомяка. Опции монтирования можно подглядеть как то так:</p>
{% highlight bash %}
mount | grep ecryptfs
{% endhighlight %}
<p>Однако замечу, что там указаны не все опции, необходимо добавить также <code>key</code>, <code>no_sig_cache</code>, <code>ecryptfs_passthrough</code>. Таким образом, для systemd mount-юнит выглядит примерно так (любители shell-простыней смогут написать свой демон, потому что через <code>fstab</code> не сработает просто так (см. ниже)).</p>
{% highlight bash %}
# cat /etc/systemd/system/home-$USER.mount
[Unit]
Before=local-fs.target
After=mnt-key.mount
[Mount]
What=/home/$USER
Where=/home/$USER
Type=ecryptfs
Options=rw,nosuid,nodev,relatime,key=passphrase:passphrase_passwd_file=/mnt/key/keyfile,no_sig_cache,ecryptfs_fnek_sig=XXXXX,ecryptfs_sig=XXXXX,ecryptfs_cipher=aes,ecryptfs_key_bytes=16,ecryptfs_passthrough=n,ecryptfs_unlink_sigs
[Install]
WantedBy=local-fs.target
{% endhighlight %}
<p><code>XXXXX</code> нужно заменить на сигнатуру из опций, с которыми сейчас смонтирована директория. Также нужно вставить имя пользователя и отредактировать путь к файлу с паролем (и имя mount-юнита), если это необходимо. Автозагрука:</p>
{% highlight bash %}
systemctl enable home-$USER.mount
{% endhighlight %}
<p>Сервис для отмонтирования флешки, когда она не нужна будет:</p>
{% highlight bash %}
# cat /etc/systemd/system/umount-key.service
[Unit]
Description=Unmount key card
Before=local-fs.target
After=home-arcanis.mount
[Service]
Type=oneshot
ExecStart=/usr/bin/umount /mnt/key
[Install]
WantedBy=local-fs.target
{% endhighlight %}
<p>Включаем:</p>
{% highlight bash %}
systemctl enable umount-key.service
{% endhighlight %}
<p>Перезагружаемся, если все ок, удаляем бекап. Если нет - значит что то где то неправильно сделали, восстанавливаем из режима восстановления.</p>
<h2><a href="#whynotfstab" class="anchor" id="whynotfstab"><span class="octicon octicon-link"></span></a>Почему не fstab?</h2>
<p>В моем случае, мне не получилось заставить флешку монтироваться раньше. Таким образом на загрузке я попадал в консоль восстановления из которой нужно было просто продолжить загрузку. Существующие в интернете методы предлагают два возможных варианта:</p>
<ul>
<li>Создать запись с опцией noauto, потом монтировать через специальную запись в <code>rc.local</code>.</li>
<li>Создать запись с опцией nofail, потом перемонтировать все разделы через <code>rc.local</code>.</li>
</ul>
<p>Оба варианта меня не устроили в виду их костыльности.</p>
<h2><a href="#whynotpam" class="anchor" id="whynotpam"><span class="octicon octicon-link"></span></a>Почему не pam?</h2>
<p>Другое распространенное предложение - монтировать через запись в настройках pam. Мне этот вариант не подходит, так как у меня авторизация беспарольная по отпечатку пальца.</p>

View File

@ -0,0 +1,138 @@
---
category: ru
type: paper
hastr: true
layout: paper
tags: awesome-widgets, pytextmonitor
title: Awesome Widgets 2.1 - свистелки и перделки
short: aw-v21-bells-and-whistles
description: Данная статья посвящена обсуждению настройки своих скриптов и графических баров в новой версии Awesome Widgets (2.1).
---
<h2><a href="#intro" class="anchor" id="intro"><span class="octicon octicon-link"></span></a>Введение</h2>
<p>Для начала, я настоятельно рекомендую для после обновления <b>не открывая настроек виджета</b> скопировать в безопасное место файл <code>$HOME/.kde4/share/config/extsysmon.conf</code>, так как старые настройки кастомных скриптов теперь несовместимы. Вообще, следует заметить, что обе новых фичи можно настраивать и из графического интерфейса, однако я опишу, как это делается простым редактированием desktop файлов.</p>
<h2><a href="#bars" class="anchor" id="bars"><span class="octicon octicon-link"></span></a>Бары</h2>
<p>Бары хранятся в двух директориях: <code>/usr/share/apps/plasma_applet_awesome-widget/desktops/</code> и <code>$HOME/.kde4/share/apps/plasma_applet_awesome-widget/desktops/</code> (пути могут немного отличаться в зависимости от используемого дистрибутива). Настройки в домашней директории перезаписывают глобальные настройки. Файлы настроек имеют следующие поля:</p>
<table>
<tr>
<th>Поле</th>
<th>Обязательное</th>
<th>Значение</th>
<th>По-умолчанию</th>
</tr>
<tr>
<th>Name</th>
<td>да</td>
<td>имя бара. Должно иметь вид <code>barN</code> и быть уникальным</td>
<td>none</td>
</tr>
<tr>
<th>Comment</th>
<td>нет</td>
<td>комментарий</td>
<td>empty</td>
</tr>
<tr>
<th>X-AW-Value</th>
<td>да</td>
<td>значение бара. Доступны теги <code>cpu*</code>, <code>gpu</code>, <code>mem</code>, <code>swap</code>, <code>hdd*</code>, <code>bat</code></td>
<td>cpu</td>
</tr>
<tr>
<th>X-AW-ActiveColor</th>
<td>да</td>
<td>заполнение активной части в формате <code>R,G,B,A</code></td>
<td>0,0,0,130</td>
</tr>
<tr>
<th>X-AW-InactiveColor</th>
<td>да</td>
<td>заполнение неактивной части в формате <code>R,G,B,A</code></td>
<td>255,255,255,130</td>
</tr>
<tr>
<th>X-AW-Type</th>
<td>да</td>
<td>тип бара. Поддерживаемые типы <code>Horizontal</code>, <code>Vertical</code>, <code>Circle</code></td>
<td>Horizontal</td>
</tr>
<tr>
<th>X-AW-Direction</th>
<td>да</td>
<td>направление заполнения. Доступны варианты <code>LeftToRight</code>, <code>RightToLeft</code></td>
<td>LeftToRight</td>
</tr>
<tr>
<th>X-AW-Height</th>
<td>да</td>
<td>высота в пикселях</td>
<td>100</td>
</tr>
<tr>
<th>X-AW-Width</th>
<td>да</td>
<td>ширина в пикселях</td>
<td>100</td>
</tr>
</table>
<h2><a href="#scripts" class="anchor" id="scripts"><span class="octicon octicon-link"></span></a>Скрипты</h2>
<p>Скрипты хранятся в двух директориях: <code>/usr/share/apps/plasma_engine_extsysmon/scripts/</code> и <code>$HOME/.kde4/share/apps/pplasma_engine_extsysmon/scripts/</code> (пути могут немного отличаться в зависимости от используемого дистрибутива). Настройки в домашней директории перезаписывают глобальные настройки. Для того, чтобы активировать скрипт необходимо прописать нужный тег в поле вывода. Файлы настроек имеют следующие поля:</p>
<table>
<tr>
<th>Поле</th>
<th>Обязательное</th>
<th>Значение</th>
<th>По-умолчанию</th>
</tr>
<tr>
<th>Name</th>
<td>да</td>
<td>имя скрипта</td>
<td>none</td>
</tr>
<tr>
<th>Comment</th>
<td>нет</td>
<td>комментарий</td>
<td>empty</td>
</tr>
<tr>
<th>Exec</th>
<td>да</td>
<td>путь к исполняемому файлу</td>
<td>/usr/bin/true</td>
</tr>
<tr>
<th>X-AW-Prefix</th>
<td>нет</td>
<td>префикс к исполняемому файлу. Обычно не требуется, однако в отдельных случаях может потребоваться явно указать путь, например, к используемому интерпретатору</td>
<td></td>
</tr>
<tr>
<th>X-AW-Active</th>
<td>нет</td>
<td>активен или нет данный скрипт</td>
<td>true</td>
</tr>
<tr>
<th>X-AW-Output</th>
<td>нет</td>
<td>имеет ли данный скрипт сообщения в консоль. Полезно выставить в <code>false</code>, если вы хотите использовать скрипт, как аналог задач в cron</td>
<td>true</td>
</tr>
<tr>
<th>X-AW-Redirect</th>
<td>нет</td>
<td>перенаправление потоков сообщений. Доступны варианты <code>stderr2stdout</code>, <code>nothing</code>, <code>stdout2stderr</code>. stderr доступен, если запустить с <code>DEBUG=yes</code></td>
<td>nothing</td>
</tr>
<tr>
<th>X-AW-Interval</th>
<td>да</td>
<td>интервал запуска скрипта в стандартных интервалах обновления виджета</td>
<td>1</td>
</tr>
</table>

View File

@ -24,6 +24,6 @@ hastr: true
<a href="{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a>
</h1>
<p><i>{% include shortdate_to_ru.html %}</i></p>
{{ post.description }}
<p>{{ post.description }}</p>
<p><b>Тэги</b>: {{ post.tags }}</p>
{% endfor %}

View File

@ -108,14 +108,6 @@ sudo make install
<th>ACPIPATH</th>
<td>Путь к устройствам ACPI. По умолчанию <code>/sys/class/power_supply/</code>.</td>
</tr>
<tr>
<th>CUSTOM</th>
<td>Свои команды для запуска. По умолчанию <code>wget -qO- http://ifconfig.me/ip</code>. Разделитель <code>@@</code>.</td>
</tr>
<tr>
<th>DESKTOPCMD</th>
<td>Комадна, которая определяет текущий рабочий стол. По умолчанию <code>qdbus org.kde.kwin /KWin currentDesktop</code>.</td>
</tr>
<tr>
<th>GPUDEV</th>
<td>Устанавливает тип GPU. Может быть <code>nvidia</code> (для nVidia), <code>ati</code> (для ATI Radeon), <code>disable</code> или <code>auto</code>. По умолчанию <code>auto</code>.</td>
@ -535,16 +527,14 @@ sudo make install
<p><b>AC offline тег:</b> Строка, которая будет показана, когда AC оффлайн. По умолчанию <code>( )</code>.</p>
<p><b>Проверять обновления:</b> Проверять или нет обновления при запуске. По умолчанию <code>проверять</code>.</p>
<h4><a href="#tooltips" class="anchor" id="tooltips"><span class="octicon octicon-link"></span></a>Тултипы</h4>
<p>Начиная с версии 1.7.0, поля CPU, частота CPU, память, swap, сеть и батарея поддерживают графический тултип (всплывающая подсказка). Чтобы включить их, просто сделайте требуемые чекбоксы полностью чекнутыми. Число хранимых значений может быть установленно во вкладке. Цвета графиков настраиваются тоже.</p>
<p>Начиная с версии 1.7.0, поля CPU, частота CPU, память, swap, сеть и батарея поддерживают графический тултип (всплывающая подсказка). Чтобы включить их, просто сделайте требуемые чекбоксы полностью чекнутыми. Число хранимых значений может быть установлено во вкладке. Цвета графиков настраиваются тоже.</p>
<h4><a href="#deguiconf" class="anchor" id="deguiconf"><span class="octicon octicon-link"></span></a>Настройка DataEngine</h4>
<p><b>Устройства ACPI:</b> Путь к устройствам ACPI. По умолчанию <code>/sys/class/power_supply/</code>.</p>
<p><b>Своя команда:</b> Команды, которые будут запущены для соответствующего поля. Например, <code>wget -qO- http://ifconfig.me/ip</code> вернет внешний IP.</p>
<p><b>Комадна для определения рабочего стола</b> Введите команду, которая будет запущеная для desktop DataEngine. По умолчанию <code>qdbus org.kde.kwin /KWin currentDesktop</code>.</p>
<p><b>Устройство GPU:</b> Выберете одно из поддерживаемых устройств GPU. <code>auto</code> включит автоматическое определение устройства, <code>disable</code> отключит все мониторы GPU. По умолчанию <code>auto</code>.</p>
<p><b>HDD:</b> Выберете один из HDD для монитора температуры HDD. <code>all</code> включит монитор для всех доступных устройств, <code>disable</code> отключит монитор температуры HDD. По умолчанию <code>all</code>.</p>
@ -606,7 +596,11 @@ sudo make install
<p><b>Вертикальная разметка:</b> Использовать вертикальную разметку вместо горизонтальной.</p>
<p><b>Добавить пустое пространство:</b> Добавить пустое пространство в указанное место виджета.</p>
<p><b>Включить тултип:</b> Включать или нет графическое превью выбранного рабочего стола. Вы также должны указать тип превью, по умолчанию <code>Окна</code>.</p>
<p><b>Ширина тултипа:</b> Ширина тултипа в пикселях. По умолчанию <code>200px</code>.</p>
<p><b>Цвет границ окна:</b> Цвет рамок окон в тултипе "Контуры". По умолчанию <code>#ffffff</code>.</p>
<p><b>Метка</b> Введите символ (или строку), которая будет показана, если данный рабочий стол сейчас активен.</p>
@ -616,6 +610,10 @@ sudo make install
<td><code>$mark</code></td>
<td>Показать метку, если данный рабочий стол активен.</td>
</tr>
<tr>
<td><code>$fullmark</code></td>
<td>Также, как и <code>$mark</code>, но показывать пустое место.</td>
</tr>
<tr>
<td><code>$name</code></td>
<td>Имя рабочего стола.</td>
@ -630,8 +628,6 @@ sudo make install
</tr>
</table>
<p><b>Команда:</b> Введите команду, которая будет запущена по клику левой кнопкой мыши на выбранном рабочем столе. Доступны те же переменные, что и для шаблонов. По умолчанию <code>dbus org.kde.kwin /KWin setCurrentDesktop $number</code>.</p>
<p><b>Скрытие панелей:</b> Выберите панели, которые будут скрыты при нажатии на горячую клавишу.</p>
<!-- end of config block -->