[[PageOutline]] [[TitleIndex(TipAndDoc/Linux,format=group)]] * distributionを知る => lsb_release -a via twitter:tm_tn/status/134106555959349248 * $ lsb_release -a {{{ No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 10.04.3 LTS Release: 10.04 Codename: lucid }}} * $ lsb_release -a {{{ LSB Version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch Distributor ID: CentOS Description: CentOS release 5.7 (Final) Release: 5.7 Codename: Final }}} * しばらくするとディスプレイがブラックアウトするのを防ぐ(未検証) * [http://www.cyberciti.biz/tips/linux-disable-screen-blanking-screen-going-blank.html Linux disable screen blanking i.e. preventing screen going blank] * [http://d.hatena.ne.jp/piyocure/20100125/1264408773 ブラックアウト - piyocureのうきょきょ] * wikipetan:マジックSysRqキー {{{ unRaw (X Window Systemからキーボードの制御を取り戻す) tErminate (すべてのプロセスにSIGTERMシグナルを送り、正常に終了させる) kIll (すべてのプロセスにSIGKILLシグナルを送り、強制的に終了させる) Sync (書き込みキャッシュのデータをディスクに書き込む) Unmount (すべてのファイルシステムを読み込み専用で再マウントする) reBoot (システムを再起動する) }}} * reboot * Alt + SysRq + b * # echo b > /proc/sysrq-trigger * [http://ubuntuforums.org/showthread.php?t=1132821 HowTO: Sudoers Configuration - Ubuntu Forums] > 2) Sudo reads the sudoers file and applies permissions in order from top to bottom. So the last line in the file will overwrite any previous conflict with the config settings. So it is best to put new configuration lines at the bottom. = Swap = * $ swapon -s {{{ Filename Type Size Used Priority /dev/sda1 partition 262136 0 -1 }}} * /proc/sys/vm/swappiness > ちなみに /proc/sys/vm/swappiness というパラメータがあって、これでスワップ具合を調整できます。 * via [http://slashdot.jp/linux/comments.pl?sid=486449&cid=1724795 コメント: Linux カーネル 2.6.33 リリース - スラッシュドット・ジャパン] = disk device = * $ ls -ld /dev/disk/by-* {{{ drwxr-xr-x 2 root root 200 2011-07-19 18:17 /dev/disk/by-id drwxr-xr-x 2 root root 140 2011-07-19 18:17 /dev/disk/by-path drwxr-xr-x 2 root root 100 2011-07-19 17:15 /dev/disk/by-uuid }}} * via [http://slashdot.jp/linux/comments.pl?sid=520826&threshold=1&commentsort=3&mode=nested&cid=1894390 コメント: Fedora15では「ethX」という表記がなくなる - スラッシュドット・ジャパン] = udev = * [http://forum.soft32.com/linux/gentoo-udev-rules-boot-SCSI-disks-ftopict332097.html |gentoo-user| udev rules and boot + SCSI disks] * [http://network.station.ez-net.jp/server/linux/storage/fix-scsi.asp EZ-NET: udev で SCSI デバイス名を固定する] * [http://www.gentoo.gr.jp/transdocs/udevrules/udevrules.html udevルールの書き方] * [http://www37.atwiki.jp/centos-homeserver/pages/20.html CentOSでホームサーバを作ろう - データ用HDDの準備] * [http://d.hatena.ne.jp/qpSHiNqp/20110214/1297651801 udevによるデバイスの命名の固定化 - しんたろの日記] * [http://www.cyberciti.biz/tips/linux-assign-static-names-to-scsi-devices.html Linux udev tip: Assign Static SCSI Device Name] * [http://baalzephon.dyndns.org/tech/index.php?udev%E3%83%A1%E3%83%A2 udevメモ - PukiWiki Plus!] == /dev/sda を他の名前にする == * 現状では成功していない === 元の状態 === * mitty@walken:~$ sudo udevadm info -q path -n /dev/sda {{{ /devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sda }}} * mitty@walken:~$ sudo udevadm info --query=all --name=/dev/sda {{{ P: /devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sda N: sda S: block/8:0 S: disk/by-id/scsi-SATA_ST3500418AS_6VM9ABYD S: disk/by-id/ata-ST3500418AS_6VM9ABYD S: disk/by-id/wwn-0x5000c5001eda26f9 S: disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0 E: UDEV_LOG=3 E: DEVPATH=/devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sda E: MAJOR=8 E: MINOR=0 E: DEVNAME=/dev/sda E: DEVTYPE=disk E: SUBSYSTEM=block E: ID_ATA=1 E: ID_TYPE=disk E: ID_BUS=ata E: ID_MODEL=ST3500418AS E: ID_MODEL_ENC=ST3500418AS\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20 E: ID_REVISION=CC38 E: ID_SERIAL=ST3500418AS_6VM9ABYD E: ID_SERIAL_SHORT=6VM9ABYD E: ID_ATA_WRITE_CACHE=1 E: ID_ATA_WRITE_CACHE_ENABLED=1 E: ID_ATA_FEATURE_SET_HPA=1 E: ID_ATA_FEATURE_SET_HPA_ENABLED=1 E: ID_ATA_FEATURE_SET_PM=1 E: ID_ATA_FEATURE_SET_PM_ENABLED=1 E: ID_ATA_FEATURE_SET_SECURITY=1 E: ID_ATA_FEATURE_SET_SECURITY_ENABLED=0 E: ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=82 E: ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=82 E: ID_ATA_FEATURE_SET_SECURITY_FROZEN=1 E: ID_ATA_FEATURE_SET_SMART=1 E: ID_ATA_FEATURE_SET_SMART_ENABLED=1 E: ID_ATA_FEATURE_SET_AAM=1 E: ID_ATA_FEATURE_SET_AAM_ENABLED=1 E: ID_ATA_FEATURE_SET_AAM_VENDOR_RECOMMENDED_VALUE=254 E: ID_ATA_FEATURE_SET_AAM_CURRENT_VALUE=254 E: ID_ATA_DOWNLOAD_MICROCODE=1 E: ID_ATA_SATA=1 E: ID_ATA_SATA_SIGNAL_RATE_GEN2=1 E: ID_ATA_SATA_SIGNAL_RATE_GEN1=1 E: ID_ATA_ROTATION_RATE_RPM=7200 E: ID_WWN=0x5000c5001eda26f9 E: ID_WWN_WITH_EXTENSION=0x5000c5001eda26f9 E: ID_SCSI_COMPAT=SATA_ST3500418AS_6VM9ABYD E: ID_PATH=pci-0000:00:1f.2-scsi-0:0:0:0 E: ID_PART_TABLE_TYPE=dos E: UDISKS_PRESENTATION_NOPOLICY=0 E: UDISKS_PARTITION_TABLE=1 E: UDISKS_PARTITION_TABLE_SCHEME=mbr E: UDISKS_PARTITION_TABLE_COUNT=2 E: UDISKS_ATA_SMART_IS_AVAILABLE=1 E: DEVLINKS=/dev/block/8:0 /dev/disk/by-id/scsi-SATA_ST3500418AS_6VM9ABYD /dev/disk/by-id/ata-ST3500418AS_6VM9ABYD /dev/disk/by-id/wwn-0x5000c5001eda26f9 /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0 }}} * mitty@walken:~$ sudo udevadm info -a --name=/dev/sda {{{ Udevadm info starts with the device specified by the devpath and then walks up the chain of parent devices. It prints for every device found, all possible attributes in the udev rules key format. A rule to match, can be composed by the attributes of the device and the attributes from one single parent device. looking at device '/devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sda': KERNEL=="sda" SUBSYSTEM=="block" DRIVER=="" ATTR{range}=="16" ATTR{ext_range}=="256" ATTR{removable}=="0" ATTR{ro}=="0" ATTR{size}=="976773168" ATTR{alignment_offset}=="0" ATTR{discard_alignment}=="0" ATTR{capability}=="50" ATTR{stat}==" 7129 217 287320 92724 2036 269 47453 141436 0 35592 234152" ATTR{inflight}==" 0 0" ATTR{events}=="" ATTR{events_async}=="" ATTR{events_poll_msecs}=="-1" looking at parent device '/devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0': KERNELS=="2:0:0:0" SUBSYSTEMS=="scsi" DRIVERS=="sd" ATTRS{device_blocked}=="0" ATTRS{type}=="0" ATTRS{scsi_level}=="6" ATTRS{vendor}=="ATA " ATTRS{model}=="ST3500418AS " ATTRS{rev}=="CC38" ATTRS{state}=="running" ATTRS{timeout}=="30" ATTRS{iocounterbits}=="32" ATTRS{iorequest_cnt}=="0x24dc" ATTRS{iodone_cnt}=="0x24c0" ATTRS{ioerr_cnt}=="0xc" ATTRS{modalias}=="scsi:t-0x00" ATTRS{evt_media_change}=="0" ATTRS{queue_depth}=="31" ATTRS{queue_ramp_up_period}=="120000" ATTRS{queue_type}=="simple" looking at parent device '/devices/pci0000:00/0000:00:1f.2/host2/target2:0:0': KERNELS=="target2:0:0" SUBSYSTEMS=="scsi" DRIVERS=="" looking at parent device '/devices/pci0000:00/0000:00:1f.2/host2': KERNELS=="host2" SUBSYSTEMS=="scsi" DRIVERS=="" looking at parent device '/devices/pci0000:00/0000:00:1f.2': KERNELS=="0000:00:1f.2" SUBSYSTEMS=="pci" DRIVERS=="ahci" ATTRS{vendor}=="0x8086" ATTRS{device}=="0x3b22" ATTRS{subsystem_vendor}=="0x8086" ATTRS{subsystem_device}=="0x0037" ATTRS{class}=="0x010601" ATTRS{irq}=="49" ATTRS{local_cpus}=="00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,0000000f" ATTRS{local_cpulist}=="0-3" ATTRS{modalias}=="pci:v00008086d00003B22sv00008086sd00000037bc01sc06i01" ATTRS{numa_node}=="-1" ATTRS{dma_mask_bits}=="64" ATTRS{consistent_dma_mask_bits}=="64" ATTRS{enable}=="1" ATTRS{broken_parity_status}=="0" ATTRS{msi_bus}=="" looking at parent device '/devices/pci0000:00': KERNELS=="pci0000:00" SUBSYSTEMS=="" DRIVERS=="" }}} * mitty@walken:~$ sudo /lib/udev/scsi_id --page=0x83 --whitelisted --device=/dev/sda {{{ 35000c5001eda26f9 }}} * mitty@walken:~$ sudo /lib/udev/scsi_id -g -u --device /dev/sda {{{ 35000c5001eda26f9 }}} * mitty@walken:~$ ls -l /sys/block/ {{{ total 0 lrwxrwxrwx 1 root root 0 Apr 16 15:09 loop0 -> ../devices/virtual/block/loop0 lrwxrwxrwx 1 root root 0 Apr 16 15:09 loop1 -> ../devices/virtual/block/loop1 lrwxrwxrwx 1 root root 0 Apr 16 15:09 loop2 -> ../devices/virtual/block/loop2 lrwxrwxrwx 1 root root 0 Apr 16 15:09 loop3 -> ../devices/virtual/block/loop3 lrwxrwxrwx 1 root root 0 Apr 16 15:09 loop4 -> ../devices/virtual/block/loop4 lrwxrwxrwx 1 root root 0 Apr 16 15:09 loop5 -> ../devices/virtual/block/loop5 lrwxrwxrwx 1 root root 0 Apr 16 15:09 loop6 -> ../devices/virtual/block/loop6 lrwxrwxrwx 1 root root 0 Apr 16 15:09 loop7 -> ../devices/virtual/block/loop7 lrwxrwxrwx 1 root root 0 Apr 16 15:09 sda -> ../devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sda lrwxrwxrwx 1 root root 0 Apr 16 15:09 sr0 -> ../devices/pci0000:00/0000:00:1f.2/host5/target5:0:0/5:0:0:0/block/sr0 }}} === 実験 === * /etc/udev/rules.d/10-fixed_hdd.rules {{{ # set device name for ST3500418AS 6VM9ABYD SUBSYSTEMS=="block", ENV{ID_SERIAL}=="ST3500418AS_6VM9ABYD", NAME="sdx%n" }}} * 成功しないがエラーも出ない * /etc/udev/rules.d/10-fixed_hdd.rules {{{ # set device name for ST3500418AS 6VM9ABYD SUBSYSTEMS=="block", PROGRAM=="/lib/udev/scsi_id -g -u --device %p", RESULT=="35000c5001eda26f9", NAME="sdx%n" }}} * mitty@walken:~$ sudo udevadm test /devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sda {{{ run_command: calling: test udevadm_test: version 164 This program is for debugging only, it does not run any program, specified by a RUN key. It may show incorrect results, because some values may be different, or not available at a simulation run. parse_file: reading '/etc/udev/rules.d/10-fixed_hdd.rules' as rules file parse_file: reading '/lib/udev/rules.d/40-hplip.rules' as rules file (snip) udev_rules_new: rules use 231672 bytes tokens (19306 * 12 bytes), 35564 bytes buffer udev_rules_new: temporary index used 60940 bytes (3047 * 20 bytes) udev_device_new_from_syspath: device 0x7f1093f7c340 has devpath '/devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sda' udev_device_new_from_syspath: device 0x7f1093f7cee0 has devpath '/devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sda' udev_device_read_db: device 0x7f1093f7cee0 filled with db file data udev_rules_apply_to_event: PROGRAM '/lib/udev/scsi_id -g -u --device /devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sda' /etc/udev/rules.d/10-fixed_hdd.rules:2 util_run_program: '/lib/udev/scsi_id -g -u --device /devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sda' started util_run_program: '/lib/udev/scsi_id -g -u --device /devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sda' returned with exitcode 1 udev_device_new_from_syspath: device 0x7f1093f7c5c0 has devpath '/devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0' udev_device_new_from_syspath: device 0x7f1093f77e30 has devpath '/devices/pci0000:00/0000:00:1f.2/host2/target2:0:0' udev_device_new_from_syspath: device 0x7f1093f78160 has devpath '/devices/pci0000:00/0000:00:1f.2/host2' udev_device_new_from_syspath: device 0x7f1093f78480 has devpath '/devices/pci0000:00/0000:00:1f.2' udev_device_new_from_syspath: device 0x7f1093f78790 has devpath '/devices/pci0000:00' (snip) }}} * mitty@walken:~$ grep scsi_id /var/log/syslog {{{ Apr 16 16:17:48 walken scsi_id[4773]: custom logging function 0x7f3411a38010 registered Apr 16 16:17:48 walken scsi_id[4773]: scsi_id: cannot open /devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sda: No such file or directory Apr 16 16:17:48 walken scsi_id[4776]: custom logging function 0x7f96ccf96010 registered }}} * scsi_idのオプションが変わった模様 * [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=493075 #493075 - scsi_id changed commandline syntax (breaks multipath) - Debian Bug report logs] * /etc/udev/rules.d/10-fixed_hdd.rules {{{ # set device name for ST3500418AS 6VM9ABYD SUBSYSTEMS=="block", DEVPATH=="/devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sda", NAME="sdx%n" }}} * boot中のコンソール画面 {{{ Waiting for /dev to be fully populated...udevd-work[353]: kernel-provided name ' sda' and NAME= 'sdx' disagree, please use SYMLINK+= or change the kernel to prov ide the proper name }}} * mitty@walken:~$ ls -l /dev/sd* {{{ brw------- 1 root root 8, 0 Apr 16 16:30 /dev/sda brw-rw---- 1 root disk 8, 1 Apr 16 16:30 /dev/sda1 brw-rw---- 1 root disk 8, 2 Apr 16 16:30 /dev/sda2 brw-rw---- 1 root disk 8, 0 Apr 16 16:30 /dev/sdx }}} * mitty@walken:~$ sudo fdisk -lu /dev/sda {{{ Disk /dev/sda: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00086666 Device Boot Start End Blocks Id System /dev/sda1 * 2048 961177599 480587776 83 Linux /dev/sda2 961177600 976771071 7796736 82 Linux swap / Solaris }}} * mitty@walken:~$ sudo fdisk -lu /dev/sdx {{{ Disk /dev/sdx: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00086666 Device Boot Start End Blocks Id System /dev/sdx1 * 2048 961177599 480587776 83 Linux /dev/sdx2 961177600 976771071 7796736 82 Linux swap / Solaris }}} * mitty@walken:~$ ls -l /sys/block/ {{{ total 0 lrwxrwxrwx 1 root root 0 Apr 16 16:51 loop0 -> ../devices/virtual/block/loop0 lrwxrwxrwx 1 root root 0 Apr 16 16:51 loop1 -> ../devices/virtual/block/loop1 lrwxrwxrwx 1 root root 0 Apr 16 16:51 loop2 -> ../devices/virtual/block/loop2 lrwxrwxrwx 1 root root 0 Apr 16 16:51 loop3 -> ../devices/virtual/block/loop3 lrwxrwxrwx 1 root root 0 Apr 16 16:51 loop4 -> ../devices/virtual/block/loop4 lrwxrwxrwx 1 root root 0 Apr 16 16:51 loop5 -> ../devices/virtual/block/loop5 lrwxrwxrwx 1 root root 0 Apr 16 16:51 loop6 -> ../devices/virtual/block/loop6 lrwxrwxrwx 1 root root 0 Apr 16 16:51 loop7 -> ../devices/virtual/block/loop7 lrwxrwxrwx 1 root root 0 Apr 16 16:51 sda -> ../devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sda lrwxrwxrwx 1 root root 0 Apr 16 16:51 sr0 -> ../devices/pci0000:00/0000:00:1f.2/host5/target5:0:0/5:0:0:0/block/sr0 }}} * 元のまま * /etc/udev/rules.d/10-fixed_hdd.rules {{{ # set device name for ST3500418AS 6VM9ABYD SUBSYSTEMS=="block", ATTR{size}=="976773168" , NAME="sdx%n" }}} * 同じエラー {{{ Waiting for /dev to be fully populated...udevd-work[353]: kernel-provided name ' sda' and NAME= 'sdx' disagree, please use SYMLINK+= or change the kernel to prov ide the proper name }}} = BackTrack = * [http://ryanunderdown.com/linux/cracking-wep-using-backtrack.php Cracking WEP Using Backtrack: A Beginner’s Guide | Ryan Underdown] * [http://samiux.blogspot.jp/2011/05/howto-wep-cracking-with-backtrack-5.html Samiux's Blog: HOWTO : WEP cracking with Back|Track 5] * [http://reisato.plala.jp/rsato/weblog/2009/10/18/2230.html GS-27USB付属のBackTrack 3でWEPキーを解析する - R SATO Weblog] * [http://bogus.jp/wp/?p=469 今年こそ使いこなしたい無線LAN攻撃ツール5 at bogus press] * [http://xeoshift.webs.com/apps/blog/show/7253600-how-to-crack-wep-with-backtrack-5 How to crack WEP with BackTrack 5 - XeoShift] * [http://www.rafayhackingarticles.net/2011/10/cracking-wep-key-with-backtrack-5.html Cracking The WEP Key With Backtrack 5 | Learn How To Hack - Ethical Hacking and security tips] * [http://ipw2200.sourceforge.net/firmware.php Intel® PRO/Wireless 2200BG Driver Firmware] * ipw2200 -> 1.2.2kmprp * sshd * sshd-generate * service ssh start = add cert on Linux = * [http://code.google.com/p/chromium/wiki/LinuxCertManagement LinuxCertManagement - chromium - Configuring SSL certificates on Linux. - An open-source browser project to help move the web forward. - Google Project Hosting] * [http://slashdot.jp/~iida/journal/525867 Debian用Chrome 9にオレオレ証明書を信頼させるには | iidaの日記 | スラッシュドット・ジャパン] > {{{ > sudo apt-get install libnss3-tools > certutil -d sql:$HOME/.pki/nssdb -A -t C,, -n 'Visual Communication Root CA1 Test' -i vcrootca1.crt > }}}