ユーザ用ツール

サイト用ツール


tipsmemo:tips

差分

このページの2つのバージョン間の差分を表示します。

この比較画面にリンクする

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
tipsmemo:tips [2018/06/19 13:49]
hayashi
tipsmemo:tips [2024/03/16 18:24] (現在)
hayashi [PHP]
行 1: 行 1:
 ====== tips ====== ====== tips ======
 +  
 +
 +===== sha512でハッシュされたsaltつきパスワードを生成する =====
 +perl
 +  $ perl -e 'print crypt("password", "\$6\$SALTsalt");'
 +  $6$SALTsalt$UiZikbV3VeeBPsg8./Q5DAfq9aj7CVZMDU6ffBiBLgUEpxv7LMXKbcZ9JSZnYDrZQftdG319XkbLVMvWcF/Vr/
 +openssl((1.1.1以降))
 +
 +  $ openssl passwd -6 -salt SALTsalt password
 +  $6$SALTsalt$UiZikbV3VeeBPsg8./Q5DAfq9aj7CVZMDU6ffBiBLgUEpxv7LMXKbcZ9JSZnYDrZQftdG319XkbLVMvWcF/Vr/
 +===== 正規表現 =====
 +
 +  * [[http://www.kt.rim.or.jp/~kbk/regex/regex.html|正規表現メモ]]
 +  * [[https://qiita.com/richmikan@github/items/b6fb641e5b2b9af3522e|どのUNIXコマンドでも使える正規表現]]
 +
 +
 ===== 開いているポートを確認する ===== ===== 開いているポートを確認する =====
 ==== netstat ==== ==== netstat ====
行 6: 行 22:
   ......   ......
  
 +pidも見る((freeBSDでは動作しない))
 +
 +  $ netstat -apn | grep LISTEN
 +  tcp        0 0.0.0.0:80  0.0.0.0: LISTEN  31xxx/nginx: worker
 +  ......
 +
 +  * -aオプション->現在の全ての接続を表示。指定しないとESTABLISHEDのみ表示
 +  * -pオプション->プロセスIDとプロセス名を表示
 +  * -nオプション->ホスト名で表示せず、IPアドレスで表示する(名前解決しない)
 ==== lsof  ==== ==== lsof  ====
 ファイル指定 ファイル指定
行 71: 行 96:
   $ echo -n 'hoge' | shasum -a 1   $ echo -n 'hoge' | shasum -a 1
   31f30ddbcb1bf8446576f0e64aa4c88a9f055e3c  -   31f30ddbcb1bf8446576f0e64aa4c88a9f055e3c  -
 +  
   $ echo -n 'hoge' | shasum -a 256   $ echo -n 'hoge' | shasum -a 256
   ecb666d778725ec97307044d642bf4d160aabb76f56c0069c71ea25b1e926825  -   ecb666d778725ec97307044d642bf4d160aabb76f56c0069c71ea25b1e926825  -
-  または  +  
   $  echo -n "hoge" | openssl sha1   $  echo -n "hoge" | openssl sha1
   (stdin)= 31f30ddbcb1bf8446576f0e64aa4c88a9f055e3c   (stdin)= 31f30ddbcb1bf8446576f0e64aa4c88a9f055e3c
 +  
 +  * -n:改行コードを出力しない
 +  * -a:アルゴリズム
  
-  -n:改行コードを出力い +GNU拡張 
-  -a:アルゴリズム+  $ openssl passwd -1 -salt "SALTsalt" "test" 
 +  $1$SALTsalt$CEvzkj.qgOcLTyU2B5Kg3. 
 +   
 +  $ openssl passwd -apr1 -salt "SaltsALT" "p@ssw0rd" 
 +  $apr1$SaltsALT$51lBhVKD0vAdzxUx/rXqY/ 
 +   
 +perl 
 +  $ perl -e 'print crypt("test", "\$6\$SALTsalt");' 
 +  $6$SALTsalt$gH47I0mRGadJVVlIpeTxVlYw.SjkPOZ7lJoGkqOyhyeUJ7PV5QWuYpIG6D5ggew6RXLpl1eA72TpgX5pGDpr/
 +python 
 +  $ python -c "import crypt, getpass, pwd; print crypt.crypt('test','\$6\$SALTsalt\$')" 
 +  $6$SALTsalt$gH47I0mRGadJVVlIpeTxVlYw.SjkPOZ7lJoGkqOyhyeUJ7PV5QWuYpIG6D5ggew6RXLpl1eA72TpgX5pGDpr/
 + 
 +===== UUID生成 ===== 
 + 
 +  $ uuidgen -r 
 + 
 +-r を付けないとランダム(UUID Version4)にならないので注意(@FreeBSD) 
 +===== ダミファイルを作る ===== 
 +10Mbyte 
 +  # dd if=/dev/zero of=10M.txt bs=1M count=10 
 + 
 +Linuxならこれも((ddより早い)) 
 + 
 +  # fallocate -l 10M 10M.txt 
 + 
 + 
 +===== SSHでパイプしつつデータ転送 ===== 
 + 
 +  cat hoge.txt | ssh host " cat > /tmp/huga.txt" 
 +===== diff コマンで横並びで表示したい ===== 
 + 
 +  diff -y path/to/file1 path/to/file2 
 + 
 +変更行のみ表示 
 + 
 +  diff -y --suppress-common-lines path/to/file1 path/to/file2
  
 ===== Gitでcheckout時にPermission Denied ===== ===== Gitでcheckout時にPermission Denied =====
行 99: 行 164:
   * 定期的に◯時間アクセスがないログファイルとかを削除したい時   * 定期的に◯時間アクセスがないログファイルとかを削除したい時
 ===== ハードウェア情報 ===== ===== ハードウェア情報 =====
-dmidecodeが便利+dmidecodeが便利((要インストール))
  
 メモリ情報 メモリ情報
行 150: 行 215:
   or   or
   apachectl configtest   apachectl configtest
 +==== nginx ====
 +  # nginx -t
 +  
 ==== postfix ==== ==== postfix ====
   # postfix check   # postfix check
  
 +何も出なければOK
 +==== lighttpd ====
 +
 +  # lighttpd -t -f /usr/local/etc/lighttpd/lighttpd.conf
 +
 +
 +==== sshd ====
 +
 +  # sshd -t
 +  
 +何も出なければOK
 +
 +==== dovecot ====
 +
 +  # doveconf -n
 +
 +==== PHP ====
 +<file php phpinfo.php>
 +<?php phpinfo(); ?>
 +</file>
 +==== Rspamd====
 +
 +  rspamadm configtest
 ===== 換算表(サブネットマスク) ===== ===== 換算表(サブネットマスク) =====
  
tipsmemo/tips.1529383757.txt.gz · 最終更新: 2018/06/19 13:49 by hayashi