{"id":2414,"date":"2019-07-06T02:35:04","date_gmt":"2019-07-05T17:35:04","guid":{"rendered":"http:\/\/matoken.org\/blog\/?p=2414"},"modified":"2019-07-10T18:38:28","modified_gmt":"2019-07-10T09:38:28","slug":"lock-linux-with-physlock","status":"publish","type":"post","link":"https:\/\/matoken.org\/blog\/2019\/07\/06\/lock-linux-with-physlock\/","title":{"rendered":"physlock \u3067 Linux \u3092\u30ed\u30c3\u30af\u3059\u308b"},"content":{"rendered":"<div class=\"paragraph\">\n<p>Debian \u3067 vlock \u3092\u691c\u7d22\u3057\u305f\u3068\u304d\u306b\u4e00\u7dd2\u306b\u51fa\u3066\u304f\u308b physlock \u3068\u3044\u3046\u3082\u306e\u304c\u6c17\u306b\u306a\u3063\u305f\u306e\u3067\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\uff0e<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre>$ apt-cache search vlock\r\nphyslock - lightweight Linux console locking tool\r\nvlock - Virtual Console locking program<\/pre>\n<\/div>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre>$ apt show physlock\r\nPackage: physlock\r\nVersion: 13-1\r\nPriority: optional\r\nSection: utils\r\nMaintainer: Michael Prokop &lt;mika@debian.org&gt;\r\nInstalled-Size: 42.0 kB\r\nDepends: libc6 (&gt;= 2.14), libpam0g (&gt;= 0.99.7.1), libsystemd0\r\nHomepage: https:\/\/github.com\/muennich\/physlock\r\nDownload-Size: 11.6 kB\r\nAPT-Manual-Installed: yes\r\nAPT-Sources: http:\/\/ftp.jp.debian.org\/debian sid\/main amd64 Packages\r\nDescription: lightweight Linux console locking tool\r\n physlock is an alternative to vlock, it is equivalent to\r\n `vlock -an'. It is written because vlock blocks some Linux\r\n kernel mechanisms like hibernate and suspend and can therefore\r\n only be used with some limitations. physlock is designed to be\r\n more lightweight and it does not have a plugin interface.\r\n\r\nN: There is 1 additional record. Please use the '-a' switch to see it<\/pre>\n<\/div>\n<\/div>\n<div class=\"ulist\">\n<ul>\n<li>\n<p><a href=\"https:\/\/github.com\/muennich\/physlock\">muennich\/physlock: Lightweight linux console locking tool<\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<div class=\"paragraph\">\n<p>vlock \u3060\u3068\u30b3\u30f3\u30bd\u30fc\u30eb\u5168\u90e8\u30ed\u30c3\u30af\u306f\u51fa\u6765\u308b\u3051\u3069\u4eee\u60f3\u30b3\u30f3\u30bd\u30fc\u30eb\u5168\u90e8\u30ed\u30c3\u30af\u3068\u304b\u306f\u51fa\u6765\u306a\u3044\u306e\u3067\u3059\u304c\uff0cphyslock \u306fX \u306e\u7aef\u672b\u3067\u8d77\u52d5\u3057\u3066\u3082X \u3082\u4f7f\u3048\u306a\u304f\u306a\u308b\u3057\uff0cconsole \u3078\u306e\u79fb\u52d5\u3082\u51fa\u6765\u306a\u3044\u3067\u3059\uff0e<br \/>\n-s \u3067 sysrq \u306e\u7121\u52b9\u5316\u3082\u51fa\u6765\u3066\uff0c-m \u3067kernel message \u306e\u6291\u5236\u3082\u51fa\u6765\u307e\u3059\uff0e(\u4f55\u3089\u304b\u306e\u7406\u7531\u3067physlock \u3092\u89e3\u9664\u3067\u304d\u306a\u3044\u3063\u3066\u5834\u5408\u306fsshd\u304c\u8d77\u52d5\u3057\u3066\u3044\u308c\u3070\u30ea\u30e2\u30fc\u30c8\u30ed\u30b0\u30a4\u30f3\u306f\u51fa\u6765\u308b\u306e\u3067kill\u3059\u308c\u3070ok)<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre>$ physlock -s -m -p \"lock!\"<\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>\u4eca\u306fX \u3067\u306f xscreensaver \u3092\u4f7f\u3063\u3066\u308b\u3051\u3069\u3053\u308c\u306f\u30b9\u30af\u30ea\u30fc\u30f3\u30bb\u30fc\u30d0\u30fc\u8d77\u52d5\u4e2d\u3067\u3082\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u79fb\u52d5\u3057\u3066\u5229\u7528\u3067\u304d\u3061\u3083\u3046\u306e\u3067physlock \u306b\u5207\u308a\u66ff\u3048\u308b\u306e\u3082\u826f\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\uff0e<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>\u6c17\u306b\u306a\u308b\u306e\u306f\u30b9\u30af\u30ea\u30fc\u30f3\u30bb\u30fc\u30d0\u30fc\u3067\u306f\u96fb\u6e90\u7ba1\u7406\u3057\u3066\u4e00\u5b9a\u4ee5\u4e0a\u306e\u6642\u9593\u304c\u7d4c\u3064\u3068\u753b\u9762\u3092\u30b9\u30ea\u30fc\u30d7\u3059\u308b\u306a\u3069\u3092\u3084\u3063\u3066\u3044\u308b\u306e\u3067\u3059\u304c\uff0cphyslock \u3067\u306f\u305d\u3046\u3044\u3063\u305f\u6a5f\u80fd\u304c\u3042\u308a\u307e\u305b\u3093\uff0e<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>physlock \u8d77\u52d5\u5f8c\u306b\u30b9\u30af\u30ea\u30fc\u30f3\u30bb\u30fc\u30d0\u30fc\u3092\u8d77\u52d5\u3059\u308b\u306e\u3082\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u304c\u3046\u307e\u304f\u884c\u304d\u307e\u305b\u3093\u3067\u3057\u305f\uff0e<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">60\u79d2\u5f8c\u306b\u30b9\u30af\u30ea\u30fc\u30f3\u30bb\u30fc\u30d0\u30fc\u3092\u8d77\u52d5\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u3044\u3066physlock\u3092\u8d77\u52d5(NG)<\/div>\n<div class=\"content\">\n<pre>$ sleep 60 &amp;&amp; xscreensaver-command -activate &amp;\r\n$ physlock<\/pre>\n<\/div>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">60\u79d2\u5f8c\u306b\u753b\u9762\u3092\u30b9\u30bf\u30f3\u30d0\u30a4\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u3044\u3066physlock\u3092\u8d77\u52d5(NG)<\/div>\n<div class=\"content\">\n<pre>$ sleep 60 &amp;&amp; xset dpms force standby &amp;\r\n$ physlock<\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>physlock \u306eGitHub \u3092\u8997\u304f\u3068physlock \u5b9f\u884c\u524d\u5f8c\u306b\u4efb\u610f\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3067\u304d\u308b\u3068\u3044\u3046PR \u304c\u3042\u308a\u307e\u3057\u305f\uff0e\u3053\u308c\u3092\u4f7f\u3048\u3070\u3069\u3046\u3060\u308d\u3046\u3068\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\uff0e<\/p>\n<\/div>\n<div class=\"ulist\">\n<ul>\n<li>\n<p><a href=\"https:\/\/github.com\/muennich\/physlock\/pull\/79\">Allow running of arbitrary commands before and after authentication by DexterLB \u00b7 Pull Request #79 \u00b7 muennich\/physlock<\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">\u74b0\u5883\u3092\u6574\u3048\u3066source\u3092\u5165\u624b\u3057\u3066PR \u306epatch \u3092\u5f53\u3066\u3066build<\/div>\n<div class=\"content\">\n<pre>$ sudo apt-get build-dep physlock\r\n$ git clone https:\/\/github.com\/muennich\/physlock\r\n$ cd physlock\r\n$ wget https:\/\/github.com\/muennich\/physlock\/pull\/79.patch\r\n$ patch -p1 &lt; .\/79.patch\r\n$ make\r\n$ sudo chown root.root .\/physlock\r\n$ sudo chmod u+s .\/physlock\r\n$ .\/physlock -h\r\nusage: physlock [-dhLlmsbanv] [-p MSG]<\/pre>\n<\/div>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">-b, -a, -n \u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u5897\u3048\u3066\u3044\u308b<\/div>\n<div class=\"content\">\n<pre>$ git diff README.md\r\ndiff --git a\/README.md b\/README.md\r\nindex bc25ca3..563e734 100644\r\n--- a\/README.md\r\n+++ b\/README.md\r\n@@ -57,6 +57,9 @@ The following command-line arguments are supported:\r\n     -l       only lock console switching\r\n     -L       only enable console switching\r\n     -m       mute kernel messages on console while physlock is running\r\n+    -b CMD   execute CMD before the password prompt\r\n+    -a CMD   execute CMD after successfully authenticating\r\n+    -n       don't actually authenticate: just execute commands\r\n     -p MSG   Display MSG before the password prompt\r\n     -s       disable sysrq key while physlock is running\r\n     -v       print version information and exit<\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>\u3057\u304b\u3057\u3053\u308c\u3082\u3046\u307e\u304f\u884c\u304d\u307e\u305b\u3093\u3067\u3057\u305f\uff0e\u753b\u9762\u306f\u66f8\u304d\u63db\u3048\u3067\u304d\u306a\u304f\u306a\u3063\u3066\u308b\u307f\u305f\u3044\u3067\u3059\uff0e<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">physlock \u306e\u524d\u306b\u30b9\u30af\u30ea\u30fc\u30f3\u30bb\u30fc\u30d0\u30fc\u3092\u8d77\u52d5(NG)<\/div>\n<div class=\"content\">\n<pre>$ .\/physlock -b 'xscreensaver-command -demo 8'<\/pre>\n<\/div>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">physlock \u306e\u524d\u306b\u753b\u9762\u3092\u30b9\u30ea\u30fc\u30d7(NG)<\/div>\n<div class=\"content\">\n<pre>$ .\/physlock -b 'xset dpms force standby'<\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>\u8fd1\u3044\u3068\u3053\u308d\u3067\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u81ea\u4f53\u3092\u30b5\u30b9\u30da\u30f3\u30c9\u306fOK\u3067\u3057\u305f\uff0e\u6301\u3061\u904b\u3073PC\u306a\u3093\u304b\u3067\u306f\u3044\u3044\u611f\u3058\u304b\u3082\u3057\u308c\u307e\u305b\u3093\uff0e<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">physlock \u306e\u524d\u306b\u30b5\u30b9\u30da\u30f3\u30c9<\/div>\n<div class=\"content\">\n<pre>$ .\/physlock -b 'systemctl suspend'<\/pre>\n<\/div>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">-b \u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u306a\u3044\u30d1\u30c3\u30b1\u30fc\u30b8\u7248\u3067\u3082\u540c\u3058\u3088\u3046\u306a\u3053\u3068\u306f\u53ef\u80fd<\/div>\n<div class=\"content\">\n<pre>$ systemctl suspend &amp;&amp; physlock<\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>\u753b\u9762\u306e\u30b9\u30ea\u30fc\u30d7\u3060\u3051\u3067\u3082\u3067\u304d\u308c\u3070\u5b09\u3057\u3044\u3093\u3067\u3059\u304c\u3053\u306e\u8fba\u306f\u30c8\u30ec\u30fc\u30c9\u30aa\u30d5\u306b\u306a\u308b\u306e\u304b\u306a?<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>&lt;ADD 2019-07-10&gt; <br \/>\nUbuntu 18.04 LTS ARM64 \u74b0\u5883\u3067package \u304b\u3089\u5c0e\u5165\u3057\u305f physlock \u3067\u306f <code>physlock: \/dev\/console: VT_GETSTATE: Inappropriate ioctl for device<\/code> \u3068\u3044\u3046\u30a8\u30e9\u30fc\u3067\u52d5\u304d\u307e\u305b\u3093\u3067\u3057\u305f\uff0e<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre>$ physlock\r\nphyslock: \/dev\/console: VT_GETSTATE: Inappropriate ioctl for device\r\n$ dpkg-query -W physlock\r\nphyslock        11-1\r\n$ hostnamectl | egrep 'Operating System|Architecture'\r\n  Operating System: Ubuntu 18.04.2 LTS\r\n      Architecture: arm64<\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>\u4ee5\u4e0b\u306e\u30d0\u30b0\u306e\u3088\u3046\u3067\u3059\uff0e<\/p>\n<\/div>\n<div class=\"ulist\">\n<ul>\n<li>\n<p><a href=\"https:\/\/github.com\/muennich\/physlock\/issues\/56\">fails to lock on aarch64 \u00b7 Issue #56 \u00b7 muennich\/physlock \u00b7 GitHub<\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<div class=\"paragraph\">\n<p><a href=\"https:\/\/github.com\/muennich\/physlock\/commit\/4f131cc2c8c05279886464d3093dd56b1331e98d\"><code>commit 4f131cc2c8c05279886464d3093dd56b1331e98d<\/code><\/a> \u3067\u4fee\u6b63\u3055\u308c\u3066\u3044\u308b(<a href=\"https:\/\/github.com\/muennich\/physlock\/releases\/tag\/v12\">release \u3060\u306812<\/a>)\u3088\u3046\u306a\u306e\u3067\uff0csource \u304b\u3089\u5c0e\u5165\u3057\u3066\u307f\u308b\u3068\u52d5\u4f5c\u3057\u307e\u3057\u305f\uff0e<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre>$ sudo apt-get build-dep physlock\r\n$ sudo apt install lib\r\n$ git clone https:\/\/github.com\/muennich\/physlock\r\n$ cd physlock\r\n$ make\r\n$ sudo make install\r\n$ \/usr\/local\/bin\/physlock -v\r\nphyslock v13<\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>&lt;\/ADD&gt;<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">\u74b0\u5883<\/div>\n<div class=\"content\">\n<pre>$ git log -1\r\ncommit d4091fe3396f6c63e42ea165797062f6032779eb (HEAD -&gt; master, tag: v13, origin\/master, origin\/HEAD)\r\nAuthor: Bert M\u00fcnnich &lt;ber.t@posteo.de&gt;\r\nDate:   Mon Jan 28 19:46:20 2019 +0100\r\n\r\n    Stable version 13\r\n$ dpkg-query -W physlock xscreensaver xorg x11-xserver-utils git git-hub\r\ngit     1:2.20.1-2\r\ngit-hub 1.0.1-1\r\nphyslock        13-1\r\nx11-xserver-utils       7.7+8\r\nxorg    1:7.7+19\r\nxscreensaver    5.42+dfsg1-1\r\n$ hostnamectl | egrep 'Operating System|Architecture'\r\n  Operating System: Ubuntu Eoan Ermine (development branch)\r\n  Architecture: x86-64<\/pre>\n<\/div>\n<\/div>\n<p><iframe style=\"width:120px;height:240px;\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" frameborder=\"0\" src=\"\/\/rcm-fe.amazon-adsystem.com\/e\/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=matokensmeme-22&#038;language=ja_JP&#038;o=9&#038;p=8&#038;l=as4&#038;m=amazon&#038;f=ifr&#038;ref=as_ss_li_til&#038;asins=B000IY07V0&#038;linkId=cd6af8984c3b5aaf2021f8e9ec38909f\"><\/iframe><iframe style=\"width:120px;height:240px;\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" frameborder=\"0\" src=\"\/\/rcm-fe.amazon-adsystem.com\/e\/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=matokensmeme-22&#038;language=ja_JP&#038;o=9&#038;p=8&#038;l=as4&#038;m=amazon&#038;f=ifr&#038;ref=as_ss_li_til&#038;asins=B07MRHH3GX&#038;linkId=d2ca893f859b48b1716a303cffacf187\"><\/iframe><iframe style=\"width:120px;height:240px;\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" frameborder=\"0\" src=\"\/\/rcm-fe.amazon-adsystem.com\/e\/cm?lt1=_blank&#038;bc1=000000&#038;IS2=1&#038;bg1=FFFFFF&#038;fc1=000000&#038;lc1=0000FF&#038;t=matokensmeme-22&#038;language=ja_JP&#038;o=9&#038;p=8&#038;l=as4&#038;m=amazon&#038;f=ifr&#038;ref=as_ss_li_til&#038;asins=B07SSGTP7W&#038;linkId=34c3c0943b5d09574cb1f1259c372687\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Debian \u3067 vlock \u3092\u691c\u7d22\u3057\u305f\u3068\u304d\u306b\u4e00\u7dd2\u306b\u51fa\u3066\u304f\u308b physlock \u3068\u3044\u3046\u3082\u306e\u304c\u6c17\u306b\u306a\u3063\u305f\u306e\u3067\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\uff0e $ apt-cache search vlock physlock &#8211; lightweight  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"webmentions_disabled_pings":false,"webmentions_disabled":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[7,6,199],"tags":[467,466],"class_list":["post-2414","post","type-post","status-publish","format-standard","hentry","category-debian-linux","category-linux","category-sid","tag-physlock","tag-vlock"],"_links":{"self":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts\/2414","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/comments?post=2414"}],"version-history":[{"count":0,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts\/2414\/revisions"}],"wp:attachment":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/media?parent=2414"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/categories?post=2414"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/tags?post=2414"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}