â Ctrl+Alt+Delã§è¨±å¯ãããã¦ã¼ã¶ãå±
ã¦ãåèµ·åããã«ã
ããCtrl+Alt+Upãã®ãã¼ãã¼ãã·ã°ãã«ã使ã£ã¦åèµ·åãããã
ãâ»Debianåºæã®æ¹æ³
â ãã¼ãã¼ããããã®è¨å®ã³ãã³ãã«ã¤ãã¦
ãâ»kbdã®è¨å®æ¹æ³ã¯ãã£ã¹ããªãã¥ã¼ã·ã§ã³æ¯ã«ç°ãªãã¾ãã
ãã大æµã®ãã£ã¹ããªãã¥ã¼ã·ã§ã³åºæã®è¨å®ã«ã¤ãã¦ã¯ã
ãã以ä¸ã®ã³ãã³ãåã§ã°ã°ãã°ãã©ããã¯ãã§ãã
$ dpkg -L kbd | grep bin/ | grep key
/bin/loadkeys
/bin/dumpkeys
/usr/bin/showkey
/usr/bin/getkeycodes
/usr/bin/setkeycodes
/usr/bin/loadkeys
/usr/bin/dumpkeys
â CUIã§ã®ã³ã³ã½ã¼ã«ã®åãæ¿ãã®ãã¼å²ãå½ã¦(ãã¼ãããã¨ã¯)
$ sudo dumpkeys | sed s/" *\|\t"/" "/g | \
grep "^ control alt keycode \(59\|6[0-9]\) = " | grep -v "nul"
control alt keycode 59 = Console_1
control alt keycode 60 = Console_2
control alt keycode 61 = Console_3
control alt keycode 62 = Console_4
control alt keycode 63 = Console_5
control alt keycode 64 = Console_6
control alt keycode 65 = Console_7
control alt keycode 66 = Console_8
control alt keycode 67 = Console_9
control alt keycode 68 = Console_10
$ sudo dumpkeys | sed s/" *\|\t"/" "/g | \
grep "^keycode \(59\|6[0-9]\)"
keycode 59 = F1
keycode 60 = F2
keycode 61 = F3
keycode 62 = F4
keycode 63 = F5
keycode 64 = F6
keycode 65 = F7
keycode 66 = F8
keycode 67 = F9
keycode 68 = F10
keycode 69 = Num_Lock
â ããã©ã«ãã§åãæ¿ããããã®ã¯ãF1ãF6ã¾ã§ã
ãâ»F7ã¯é常ãX Windowã«å²ãå½ã¦ããã¦ããã®ã§ãF8ãF10ã¾ã§ã®3ã¤ã追å ã§ããã
ãããã®æç¹ã§ãã£ã¹ããªãã¥ã¼ã·ã§ã³ã®èãæ¹ãåæ ããã¦ããã
ããF7ãã¾ããã§ããã©ã«ãã§F8以éã§ãåãæ¿ãããããã£ã¹ããªãã¥ã¼ã·ã§ã³ãããã¯ãã§ãã
$ ps -ef | grep tty | grep -v grep
root 1803 1 0 Nov16 tty1 00:00:00 /sbin/getty 38400 tty1
root 1804 1 0 Nov16 tty2 00:00:00 /sbin/getty 38400 tty2
root 1805 1 0 Nov16 tty3 00:00:00 /sbin/getty 38400 tty3
root 1806 1 0 Nov16 tty4 00:00:00 /sbin/getty 38400 tty4
root 1807 1 0 Nov16 tty5 00:00:00 /sbin/getty 38400 tty5
root 1808 1 0 Nov16 tty6 00:00:00 /sbin/getty 38400 tty6
â Deleteãã¼ã®å²ãå½ã¦ã¯14ã
ãCtrl+Alt+Delã¯ãMeta_BackSpaceãã¨ãã¦å²ãå½ã¦ããã¦ããã
$ sudo dumpkeys | sed s/" *\|\t"/" "/g | grep "^keycode [0-9]* = Del"
keycode 14 = Delete
$ sudo dumpkeys | sed s/" *\|\t"/" "/g | grep "^ control alt keycode 14 ="
control alt keycode 14 = Meta_BackSpace
â ãCtrl+Alt+Delãã§ã¯åèµ·åããè¨å®ã«ãªã£ã¦ããã
$ grep ^ca /etc/inittab
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
â ã¡ãªã¿ã«BackSpaceãã¼ã¯ããèªä½ãã·ã§ã¼ãã«ããã§ããã
ãã¾ããCtrl+Alt+BackSpaceã¯GUIã®ãã¼ãããè¨å®ã§X Windowããæããã®ã«ã使ãããã
ããã£ã¦ãããã§ã¯å¥ã®ãã¼å²ãå½ã¦ãèããã
ãâ»ä¸è¨ã§X Windowããæãããã¨ãåºæ¥ãªãå ´åã¯ãX Windowèµ·åä¸ã«Ctrl+Alt+F1çã«éé¿ãã¦killãããã¨ãåºæ¥ãã
$ sudo dumpkeys | sed s/" *\|\t"/" "/g | grep "[0-9]* = Back" | sort -u | wc -l
64
â å¤ãã®ãã£ã¹ããªãã¥ã¼ã·ã§ã³ã®èª¬æã«ããrunlevelã«é¢ä¿ãªãç¡å¹ã«ããè¨å®ãããã¨æãã
ããã°ã¤ã³ã¦ã¼ã¶ã確èªããã«ã¯ãããããã®runlevelãå¿
è¦ã
ãæ´æ°ãããããsyslogãã確èªã
$ grep ^ca /etc/inittab
ca:12345:ctrlaltdel:
$ sudo init q
$ sudo tail -1 /var/log/syslog | sed s/".*\(init\:\)"/"\1"/
init: Re-reading inittab
â ãã¡ãããç°å¢ã«ãã£ã¦ä»¥ä¸ã¯ç°ãªãã®ã§ããã°ã®ååã¯syslogã§ã¯ç¡ãããç¥ããªãã
$ ps -ef | grep rsyslog | grep -v grep
root 1085 1 0 Nov16 ? 00:00:01 /usr/sbin/rsyslogd -c4
$ grep "syslog\$" /etc/rsyslog.conf
*.*;auth,authpriv.none -/var/log/syslog
â shutdownã³ãã³ãã®å¼æ°ããã£ã¹ããªãã¥ã¼ã·ã§ã³ã®èãæ¹ãåæ ãããã
ãâ»ã/etc/shutdown.allowãã¯ããã©ã«ãã§ã¯åå¨ããªãã
$ man shutdown | grep "\-a.*shutdown.allow"
-a /etc/shutdown.allow ã使ãã
â 許å¯ããã¦ã¼ã¶ãrootããã°ã¤ã³ä¸ã®ã¿Ctrl+Alt+Delã§åèµ·ååºæ¥ããªãã
ããã°ã¤ã³ããã«ãã¾ãã¯runlevelãæ°ã«ããã«initã«ã·ã°ãã«ãéãæ¹æ³ãèããå¿
è¦ãããããç¥ããªãã
$ grep ^ci /etc/inittab
ci::kbrequest:/sbin/shutdown -t1 -a -r now
$ sudo tail -1 /var/log/syslog | sed s/".*\(init\:\)"/"\1"/
init: Re-reading inittab
â å½ç¶ã ãã許å¯ããã¦ã¼ã¶ããã°ã¤ã³ãã¦ããããã¨ãã£ã¦ã
ããã®ã¦ã¼ã¶ãroot権éãªãã«shutdownã³ãã³ããå®è¡ãããã¨ã¯åºæ¥ãªãã
$ /sbin/shutdown -r now 2>&1 | head -1
shutdown: you must be root to do that!
â å°ãªãã¨ãinitãSIGINTã«å¿çããä¸è¨æ¡ä»¶ä»¥å¤ã®æã«ã¯ã³ã³ã½ã¼ã«ã«ä»¥ä¸ã®è¡¨ç¤ºããããã
shutdown: no authorized users logged in
â inittabèªä½ãææ¸ã¯ä¸å®å
¨ãªçºããci::ããããã©ã«ãã§ã¯è¨è¼ããã¦ããªãçç±ã ã¨æãããã
$ man inittab 2>&1 | grep -A 10 "kbrequest\$" | sed s/" *"/" "/g
kbrequest
initããã¼ãã¼ããã³ãã©ã¼ãããã³ã³ã½ã¼ã«ãã¼ãã¼ãä¸ã§ç¹å®ã®çµã¿åãã
ã®ãã¼å
¥åãè¡ãªããããã¨ã®ã·ã°ãã«ãåãåã£ãã¨ãã«å®è¡ãããã
ãã®æ©è½ã«é¢ããææ¸ã¯ã¾ã ä¸å®å
¨ã§ãã; kbd-x.xx ããã±ã¼ã¸ä¸ãæ¢ãã°ããå¤ãã®è³æãè¦ã¤ããã ãã
(ãã®ææ¸ãæ¸ãã¦ããæç¹ã§ææ°ã®ãã®ã¯ kbd-0.94 ã§ãã)ã åºæ¬çã«ã¯ããããã¼ã®çµã¿åããã"Keyâ
boardSignal"ã¨ããåä½ã«çµã³ã¤ããã ã¨ããå ´åã«ç¨ããããã
ä¾ãã°ãAlt-ä¸åãç¢å°ã¨ãããã¼ã®çµã¿åããããã®ç¨éã«ä½¿ãããå ´åã¯ã ãã¼ããããã¡ã¤ã«ä¸ã«æ¬¡ã®æ§ã«æ¸ãã¦ããã°ãã:
alt keycode 103 = KeyboardSignal
â Alt+Upã¯ä»¥ä¸ã®ããã«ãã¼ãå²ãå½ã¦ããã¦ããã
$ sudo dumpkeys | sed s/" *\|\t"/" "/g | grep "^keycode" | grep "Alt\|Up" | sort -k 4
keycode 100 = Alt
keycode 125 = Alt
keycode 126 = Alt
keycode 56 = Alt
keycode 103 = Up
â ãAlt+Upãã¯ããã©ã«ãã§ãKeyboardSignalãã«å²ãå½ã¦ããã¦ããã
$ sudo dumpkeys | sed s/" *\|\t"/" "/g | grep "^ alt keycode 103 = " | grep -v "nul"
alt keycode 103 = KeyboardSignal
â ä»ã«ã¯ãKeyboardSignalãã«ä»¥ä¸ã®ãã¼ãå²ãå½ã¦ããã¦ããã
$ sudo dumpkeys | sed s/" *\|\t"/" "/g | grep "KeyboardSignal"
alt keycode 103 = KeyboardSignal
alt shiftl keycode 103 = KeyboardSignal
alt shiftr keycode 103 = KeyboardSignal
alt shiftl shiftr keycode 103 = KeyboardSignal
alt ctrll keycode 103 = KeyboardSignal
alt shiftl ctrll keycode 103 = KeyboardSignal
alt shiftr ctrll keycode 103 = KeyboardSignal
alt shiftl shiftr ctrll keycode 103 = KeyboardSignal
â CapsLockã¨Controlãã¼ã®å
¥ãæ¿ãã¯å®å
¨ã«ä»ã®ãã£ã¹ããªãã¥ã¼ã·ã§ã³ã¨ã¯ç°ãªãæ¹æ³ã§ããã
$ cat /etc/kbd/remap
â å½ç¶ã/lib/kbdããã£ã¬ã¯ããªã¯åå¨ããªããã
ãã/lib/kbd/keymaps/i386/qwerty/ãã/usr/lib/kbd/keymaps/i386/qwerty/ãçã
ãåãlibãé
ä¸ã®ãjp106.map.gzãç´æ¥ç·¨éãããã£ã¹ããªãã¥ã¼ã·ã§ã³ãªãã°ã
ãå¤æ´ããããä»æ§ãªã®ã§ãç£è¦ãæ ã£ã¦ã¯ãªããªãã
$ dpkg -L kbd | grep "etc/" | grep kbd
/etc/init.d/kbd
/etc/kbd
/etc/kbd/config
/etc/kbd/remap
$ dpkg -L kbd | grep lib || echo "No lib"
No lib
â ãAlt+Upããç¡å¹ã«ãã¦ããAlt+Ctrl+Upãã使ãããã«ããã
$ echo "alt keycode 103 = nul" | sudo loadkeys
$ sudo dumpkeys | grep Signal
alt shiftl keycode 103 = KeyboardSignal
alt shiftr keycode 103 = KeyboardSignal
alt shiftl shiftr keycode 103 = KeyboardSignal
alt ctrll keycode 103 = KeyboardSignal
alt shiftl ctrll keycode 103 = KeyboardSignal
alt shiftr ctrll keycode 103 = KeyboardSignal
alt shiftl shiftr ctrll keycode 103 = KeyboardSignal
$ echo "control alt keycode 103 = KeyboardSignal" | sudo loadkeys
$ sudo dumpkeys | grep Signal | head -1
control alt keycode 103 = KeyboardSignal
â 以ä¸ã«è¦ãã¨ãããã/etc/kbd/remapãã«ã¯ãloadkeysã«æ¸¡ãsedã³ãã³ãè¡ãæ¸ãã°ããã®ã ãããã
$ sudo grep -A 3 "#.*remap" /etc/init.d/kbd
if [ -z "${HAVE_SETUPCON}" -a -r /etc/$PKG/remap ]; then
dumpkeys < ${DEVICE_PREFIX}1 | sed -f /etc/$PKG/remap | loadkeys --quiet
fi
$ tail -1 /etc/kbd/remap
s/alt keycode 103 = KeyboardSignal/alt keycode 103 = nul/;
â ã/bin/shãã§æ¸ããã¦ããã®ã§ããããã°ã¢ã¼ãã使ããã
ãâ»ãã ããã³ã³ã½ã¼ã«ã§å®è¡ããå ´åã®ã¿ãdpkg-reconfigureãåãã
ããã¨ããããããããã©ã°ãç«ã£ã¦ãããå®è¡ããã¦ããªãã
$ sudo head -1 /etc/init.d/kbd
$ sudo /bin/sh -x /etc/init.d/kbd restart | grep -v "^\+"
Setting console screen modes.
Skipping font and keymap setup (handled by console-setup).
$ sudo dpkg-reconfigure kbd
Setting console screen modes.
Skipping font and keymap setup (handled by console-setup).
â ãã°ãªã®ãããã¡ãã®è¨å®ééããªã®ããã¹ãããããã¦ããã®ã§ã
ãsetupé¢æ°ã¨ãã®ãã§ãã¯ã®ããå¾ãã«è¨è¼ãã¦å¼·å¶ããã
ãâ»èªã¿ã«ããã®ã§ãã¹ã¯ãªããã追ãã®ã¯å¾æ¥ã
$ sudo grep -B 2 -A 1 "103 = nul" /etc/init.d/kbd
setup
[ -z "$HAVE_SETUPCON" ] || log_action_msg "Skipping font and keymap setup (handled by console-setup)"
echo "alt keycode 103 = nul" | loadkeys
echo "control alt keycode 103 = KeyboardSignal" | loadkeys
â 以ä¸ã®éããµã¼ãã¹ã®åèµ·åã§æå¹ã«ãªã£ãã
$ echo "alt keycode 103 = KeyboardSignal" | sudo loadkeys
$ sudo dumpkeys | grep "KeyboardSignal" |head -1
alt keycode 103 = KeyboardSignal
$ sudo /etc/init.d/kbd restart
$ sudo dumpkeys | grep "KeyboardSignal" |head -1
control alt keycode 103 = KeyboardSignal
â ãAlt+Upãã¯å¹ããããCtrl+Alt+Upãã§ã³ã³ã½ã¼ã«ã«Helloã¨è¡¨ç¤ºããããã¨ã確èªããã
$ sudo grep ^ci /etc/inittab
ci::kbrequest:echo "Hello"
$ sudo init q
$ sudo tail -1 /var/log/syslog | grep init | sed s/".*\(init\:\)"/"\1"/
init: Re-reading inittab
â ä¸è¨ã使ããã®ã§ãctrlaltdelæã®ã¢ã¯ã·ã§ã³ã次ã®ããã«å¤æ´ããã
$ sudo grep ^ca /etc/inittab
ca:12345:ctrlaltdel:echo "Please Ctrl+Alt+Up key to reboot!"
$ sudo init q
$ sudo tail -1 /var/log/syslog | grep init | sed s/".*\(init\:\)"/"\1"/
init: Re-reading inittab
â ããã§ããã¼ãã¼ãããã®ctrlaltdelã®SIGINTã«initãåå¿ãããªãã°ãkbrequestã§åèµ·ååºæ¥ãã
ãã¾ããrunlevelãä¸æã許å¯ãããã¦ã¼ã¶ããã°ã¤ã³ãã¦ããªãã¦ããã·ã§ã¼ãã«ãããã¼ãç¥ã£ã¦ãã人ãªãåèµ·ååºæ¥ãã
ãâ»å½ç¶ãç§ã®ç°å¢ã§ã¯å¥ã®ãã¼ãå²ãå½ã¦ãã®ã§ããããããwããã