<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Michal Sylwester &#187; Linux</title>
	<atom:link href="http://arakilab.media.eng.hokudai.ac.jp/~msylw/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://arakilab.media.eng.hokudai.ac.jp/~msylw</link>
	<description></description>
	<lastBuildDate>Wed, 26 Feb 2014 02:34:18 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.8.1</generator>
	<item>
		<title>Using udev to trigger events in example</title>
		<link>http://arakilab.media.eng.hokudai.ac.jp/~msylw/2013/07/using-udev-to-trigger-events-in-example/</link>
		<comments>http://arakilab.media.eng.hokudai.ac.jp/~msylw/2013/07/using-udev-to-trigger-events-in-example/#comments</comments>
		<pubDate>Mon, 08 Jul 2013 04:09:58 +0000</pubDate>
		<dc:creator><![CDATA[Michal Sylwester]]></dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://arakilab.media.eng.hokudai.ac.jp/~msylw/?p=42</guid>
		<description><![CDATA[Find device (this works only with input devices): [crayon-6a71cb5a41788849799346/] Use the name to find system path of the device: [crayon-6a71cb5a41796559507707/] Make a test run: [crayon-6a71cb5a4179c478767422/] Look data that is specific to device you want to customize. ID_TYPE=hid is too general, &#8230; <a href="http://arakilab.media.eng.hokudai.ac.jp/~msylw/2013/07/using-udev-to-trigger-events-in-example/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Find device (this works only with input devices):</p><pre class="crayon-plain-tag">$ sudo lsinput

/dev/input/event5
 bustype : BUS_USB
 vendor : 0x46e
 product : 0x52cb
 version : 272
 name : &quot;BTC USB Multimedia Keyboard&quot;
 phys : &quot;usb-0000:00:06.1-4.3/input1&quot;
 uniq : &quot;&quot;
 bits ev : EV_SYN EV_KEY EV_MSC

/dev/input/event6
 bustype : BUS_USB
 vendor : 0x458
 product : 0x5e
 version : 272
 name : &quot;KYE ADNS6000 Optical Mouse&quot;
 phys : &quot;usb-0000:00:06.1-4.4/input0&quot;
 uniq : &quot;&quot;
 bits ev : EV_SYN EV_KEY EV_REL EV_MSC</pre><p>Use the name to find system path of the device:</p><pre class="crayon-plain-tag">$ udevadm info -q path -n /dev/input/event5
/devices/pci0000:00/0000:00:06.1/usb2/2-4/2-4.3/2-4.3:1.1/input/input5/event5</pre><p>Make a test run:</p><pre class="crayon-plain-tag">$ udevadm test /devices/pci0000:00/0000:00:06.1/usb2/2-4/2-4.3/2-4.3:1.1/input/input5/event5
(...)
udev_device_update_db: unable to create temporary db file '/run/udev/data/c13:69.tmp': Permission denied
ACTION=add
DEVLINKS=/dev/input/by-id/usb-BTC_USB_Multimedia_Keyboard-event-if01 /dev/input/by-path/pci-0000:00:06.1-usb-0:4.3:1.1-event
DEVNAME=/dev/input/event5
DEVPATH=/devices/pci0000:00/0000:00:06.1/usb2/2-4/2-4.3/2-4.3:1.1/input/input5/event5
ID_BUS=usb
ID_INPUT=1
ID_INPUT_KEY=1
ID_MODEL=USB_Multimedia_Keyboard
ID_MODEL_ENC=USB\x20Multimedia\x20Keyboard
ID_MODEL_ID=52cb
ID_PATH=pci-0000:00:06.1-usb-0:4.3:1.1
ID_PATH_TAG=pci-0000_00_06_1-usb-0_4_3_1_1
ID_REVISION=0110
ID_SERIAL=BTC_USB_Multimedia_Keyboard
ID_TYPE=hid
ID_USB_DRIVER=usbhid
ID_USB_INTERFACES=:030101:030000:
ID_USB_INTERFACE_NUM=01
ID_VENDOR=BTC
ID_VENDOR_ENC=BTC
ID_VENDOR_ID=046e
MAJOR=13
MINOR=69
SUBSYSTEM=input
UDEV_LOG=6
USEC_INITIALIZED=4552168
XKBLAYOUT=us
XKBMODEL=pc105
XKBOPTIONS=
XKBVARIANT=</pre><p>Look data that is specific to device you want to customize. ID_TYPE=hid is too general, but perhaps ID_VENDOR_ID or ID_MODEL_ID. Sometime there is some tip about device type like ID_INPUT_TOUCHPAD=1. If the data seems too general, it may be better to attach to parent device, run the command again without the last &#8220;event&#8221; part:</p><pre class="crayon-plain-tag">$ udevadm test /devices/pci0000:00/0000:00:06.1/usb2/2-4/2-4.3/2-4.3:1.1/input/input5</pre><p>Still, try to find something as close to the end of the chain as possible. Another way worth of trying is to run udevadm info:</p><pre class="crayon-plain-tag">$ udevadm info -a -p
/devices/pci0000:00/0000:00:06.1/usb2/2-4/2-4.3/2-4.3:1.1/input/input5/event5</pre><p>Finding the right filter rules seems to be always most difficult for me&#8230; Create a new file in /etc/udev/rules.d starting with 2-digit number (this is rule&#8217;s priority, I suggest a large one to keep the rule close to the end of the chain). My rules for detecting a Apple Bluetooth keyboard and  a touchpad are:</p><pre class="crayon-plain-tag">ACTION!=&quot;add|change&quot;, GOTO=&quot;apple_kbd_end&quot;
SUBSYSTEM!=&quot;input&quot;, GOTO=&quot;apple_kbd_end&quot;
KERNEL!=&quot;event[0-9]*&quot;, GOTO=&quot;apple_kbd_end&quot;

ATTRS{address}==&quot;60:fb:42:02:12:a9&quot;, RUN+=&quot;keymap $name apple&quot;
ENV{ID_INPUT_TOUCHPAD}==&quot;1&quot;, RUN+=&quot;/home/test/bin/send-command hostname slowgestures&quot;

&lt;span style=&quot;font-family: 'Courier 10 Pitch', Courier, monospace; font-size: 13px; font-style: normal; line-height: 1.5;&quot;&gt;LABEL=&quot;apple_kbd_end&quot;&lt;/span&gt;</pre><p>So I&#8217;m using Bluetooth address for keyboard and ID_INPUT_TOUCHPAD for the touchpad. When it is added to system, a script &#8220;send-command&#8221; will be run. After editing the file, save it and run the udevadm test again:</p><pre class="crayon-plain-tag">$ udevadm test /devices/pci0000:00/0000:00:06.1/usb2/2-4/2-4.3/2-4.3:1.1/input/input5/event5

USEC_INITIALIZED=150940194993
run: '/home/test/bin/send-command hostname slowgestures'</pre><p>Check the run command is there. If not, change the rules and try again. If it worked, run one last command to inform the udev daemon about the changes:</p><pre class="crayon-plain-tag">sudo udevadm control --reload-rules</pre><p>That&#8217;s it. Now it&#8217;s up to you to write the event handlers.</p>
]]></content:encoded>
			<wfw:commentRss>http://arakilab.media.eng.hokudai.ac.jp/~msylw/2013/07/using-udev-to-trigger-events-in-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using SSH without password</title>
		<link>http://arakilab.media.eng.hokudai.ac.jp/~msylw/2013/06/using-ssh-without-password/</link>
		<comments>http://arakilab.media.eng.hokudai.ac.jp/~msylw/2013/06/using-ssh-without-password/#comments</comments>
		<pubDate>Sat, 22 Jun 2013 08:49:09 +0000</pubDate>
		<dc:creator><![CDATA[Michal Sylwester]]></dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://arakilab.media.eng.hokudai.ac.jp/~msylw/wp/?p=17</guid>
		<description><![CDATA[Using SSH often to login to remote systems? Sick of entering your password every few minutes? Consider logging using public key authentication. What is this? This authentication method uses 2 keys: private and public. Let&#8217;s use example: S is some &#8230; <a href="http://arakilab.media.eng.hokudai.ac.jp/~msylw/2013/06/using-ssh-without-password/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Using SSH often to login to remote systems? Sick of entering your password every few minutes? Consider logging using public key authentication.</p>
<h1>What is this?</h1>
<p>This authentication method uses 2 keys: private and public. Let&#8217;s use example:</p>
<ul>
<li>S is some remote server</li>
<li>C is your laptop</li>
</ul>
<p>The public key is put on server. It can be shared with anyone, it is of no use to anyone except the owner of the private key.</p>
<p>The private key is kept in safe place on laptop. During authentication server S verifies whether the secret key from C matches the public key on S. If so, user is allowed to log in. It is important to remember, keeping the private key secret is just as important as guarding your password.</p>
<h1>Preparation</h1>
<p>Simpler than it used to be&#8230; To generate the new key pair:</p><pre class="crayon-plain-tag">ssh-keygen</pre><p>and follow defaults. There will be a warning if the key already exists. For simplicity don&#8217;t specify a password (I will write how to use a password protected key without having to type too much another time).</p>
<p>Now, to copy the public key to remote sever run:</p><pre class="crayon-plain-tag">ssh-copy-id server</pre><p>Enter the password once more, and try:</p><pre class="crayon-plain-tag">ssh server</pre><p>Congratulations! And remember to protect the key!</p>
]]></content:encoded>
			<wfw:commentRss>http://arakilab.media.eng.hokudai.ac.jp/~msylw/2013/06/using-ssh-without-password/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
