{"id":2408,"date":"2019-06-30T23:03:00","date_gmt":"2019-06-30T14:03:00","guid":{"rendered":"http:\/\/matoken.org\/blog\/?p=2408"},"modified":"2019-06-30T23:03:00","modified_gmt":"2019-06-30T14:03:00","slug":"lock-tmux-with-vlock-command","status":"publish","type":"post","link":"https:\/\/matoken.org\/blog\/2019\/06\/30\/lock-tmux-with-vlock-command\/","title":{"rendered":"vlock \u30b3\u30de\u30f3\u30c9\u3067 tmux \u3092\u30ed\u30c3\u30af\u3059\u308b"},"content":{"rendered":"<div class=\"paragraph\">\n<p>\u73fe\u5728\u30bf\u30fc\u30df\u30ca\u30eb\u30de\u30eb\u30c1\u30d7\u30ec\u30af\u30b5\u306f Byobu \u7d4c\u7531\u3067 GNU screen \u3068 tmux \u3092\u74b0\u5883\u306b\u3088\u308a\u4f75\u7528\u3057\u3066\u3044\u307e\u3059\uff0eGNU screen \u3067\u306f\u753b\u9762\u30ed\u30c3\u30af\u306e\u8a2d\u5b9a\u3092\u3057\u3066\u3044\u305f\u306e\u3067\u3059\u304ctmux \u306f\u8a2d\u5b9a\u3057\u3066\u3044\u306a\u304b\u3063\u305f\u306e\u3067\u4eca\u56de console lock \u30b3\u30de\u30f3\u30c9\u306e vlock \u3092\u8a2d\u5b9a\u3057\u3066\u307f\u307e\u3057\u305f\uff0e<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">\u5c0e\u5165<\/div>\n<div class=\"content\">\n<pre>$ sudo apt install vlock<\/pre>\n<\/div>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">help<\/div>\n<div class=\"content\">\n<pre>$ vlock -h\r\nvlock: locks virtual consoles, saving your current session.\r\nUsage: vlock [options] [plugins...]\r\n\t   Where [options] are any of:\r\n-c or --current: lock only this virtual console, allowing user to\r\n\t   switch to other virtual consoles.\r\n-a or --all: lock all virtual consoles by preventing other users\r\n\t   from switching virtual consoles.\r\n-n or --new: allocate a new virtual console before locking,\r\n\t   implies --all.\r\n-s or --disable-sysrq: disable SysRq while consoles are locked to\r\n\t   prevent killing vlock with SAK\r\n-t &lt;seconds&gt; or --timeout &lt;seconds&gt;: run screen saver plugins\r\n\t   after the given amount of time.\r\n-v or --version: Print the version number of vlock and exit.\r\n-h or --help: Print this help message and exit.<\/pre>\n<\/div>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">\u30ab\u30ec\u30f3\u30c8\u30b3\u30f3\u30bd\u30fc\u30eb\u3092lock \u3057\u3066\u307f\u308b\uff0e\u4f55\u304b\u30ad\u30fc\u3092\u62bc\u3057\u305f\u5f8c\u30e6\u30fc\u30b6\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3059\u308b\u3053\u3068\u3067\u5fa9\u5e30\u3067\u304d\u308b\uff0e<\/div>\n<div class=\"content\">\n<pre>$ vlock -c\r\nThis TTY is now locked.\r\n\r\nPlease press [ENTER] to unlock.\r\nmatoken's Password:<\/pre>\n<\/div>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">\u5168\u3066\u306e\u30b3\u30f3\u30bd\u30fc\u30eb\u3092\u30ed\u30c3\u30af\u3059\u308b\uff0e\u30ed\u30c3\u30af\u72b6\u614b\u3067 Alt + n \u3067\u4ed6\u306e\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u79fb\u52d5\u3057\u3066\u3082\u5168\u3066\u30ed\u30c3\u30af\u3055\u308c\u3066\u3044\u308b\uff0e<\/div>\n<div class=\"content\">\n<pre>$ vlock -a\r\nThe entire console display is now completely locked.\r\nYou will not be able to switch to another virtual console.\r\n\r\nPlease press [ENTER] to unlock.\r\nmatoken's Password:\r\n$ tty\r\n\/dev\/tty1<\/pre>\n<\/div>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">\u4eee\u60f3\u30b3\u30f3\u30bd\u30fc\u30eb(X\u306e\u7aef\u672b, \u30bf\u30fc\u30df\u30ca\u30eb\u30de\u30eb\u30c1\u30d7\u30ec\u30af\u30b5, script\u7b49)\u3067\u306f\u5168\u3066\u306e\u30ed\u30c3\u30af\u306f\u5931\u6557\u3059\u308b<\/div>\n<div class=\"content\">\n<pre>$ vlock -a\r\nvlock: this terminal is not a virtual console\r\n$ tty\r\n\/dev\/pts\/9<\/pre>\n<\/div>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">tmux \u306b\u8a2d\u5b9a\u3057\u3066\u307f\u308b(byobu \u7d4c\u7531\u306e\u5834\u5408)<\/div>\n<div class=\"content\">\n<pre>$ cat ~\/.byobu\/.tmux.conf\r\n# Enable locking(I need vlock -&gt; sudo apt install vlock)\r\nset -g lock-command vlock\r\nset -g lock-after-time 0\r\nbind l lock-session<\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p><code>.tmux.conf<\/code> \u306b\u8a2d\u5b9a\u3057\u305f\u72b6\u614b\u3067 tmux \u3092\u8d77\u52d5\u3057\u3066 Ctrl+b l \u3068\u62bc\u3059\u3068 vlock \u3067\u30ed\u30c3\u30af\u3055\u308c\u307e\u3059\uff0e\u30bb\u30c3\u30b7\u30e7\u30f3\u5358\u4f4d\u3067\u30ed\u30c3\u30af\u3055\u308c\u307e\u3059\uff0e<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>\u3061\u306a\u307f\u306b X \u3067\u306f <code>xscreensaver-command -activate<\/code> \u3092\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059\uff0e\u4f8b\u3048\u3070\u4ee5\u4e0b\u306f awesome wm \u3067 Mod4 + l \u306b\u8a2d\u5b9a\u3057\u3066\u3042\u308a\u307e\u3059\uff0e<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre>    -- lock screen\r\n    awful.key({ \"Mod1\"  }, \"l\", function () awful.util.spawn( \"xscreensaver-command -activate\",false) end),<\/pre>\n<\/div>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"title\">\u74b0\u58831<\/div>\n<div class=\"content\">\n<pre>$ dpkg-query -W byobu screen tmux vlock\r\nbyobu   5.129-1\r\nscreen  4.6.2-3\r\ntmux    2.8-3\r\nvlock   2.2.2-8\r\n$ hostnamectl | egrep 'Operating System|Architecture'\r\n  Operating System: Debian GNU\/Linux 10 (buster)\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=B07SSGTP7W&#038;linkId=f90496d3ef37b69b633bbac4ec14906a\"><\/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=B00TQMFOCW&#038;linkId=4ca38c7b27879eb9f6608f2ceeb81a7b\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u73fe\u5728\u30bf\u30fc\u30df\u30ca\u30eb\u30de\u30eb\u30c1\u30d7\u30ec\u30af\u30b5\u306f Byobu \u7d4c\u7531\u3067 GNU screen \u3068 tmux \u3092\u74b0\u5883\u306b\u3088\u308a\u4f75\u7528\u3057\u3066\u3044\u307e\u3059\uff0eGNU screen \u3067\u306f\u753b\u9762\u30ed\u30c3\u30af\u306e\u8a2d\u5b9a\u3092\u3057\u3066\u3044\u305f\u306e\u3067\u3059\u304ctmux \u306f\u8a2d\u5b9a\u3057\u3066\u3044\u306a\u304b\u3063\u305f\u306e\u3067\u4eca\u56de co [&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":[155,464],"class_list":["post-2408","post","type-post","status-publish","format-standard","hentry","category-debian-linux","category-linux","category-sid","tag-byobu","tag-tmux"],"_links":{"self":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts\/2408","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=2408"}],"version-history":[{"count":0,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/posts\/2408\/revisions"}],"wp:attachment":[{"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/media?parent=2408"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/categories?post=2408"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/matoken.org\/blog\/wp-json\/wp\/v2\/tags?post=2408"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}