memo/201907
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
#highlighter(){{
09
10 東京 02:00 → 上海 04:35
上海 09:05 → トルファン 16:15
Sogdiana Guesthouse泊
11 Sogdiana Guesthouse泊
12 トルファン 00:00 → タクラマカン
13 タクラマカン → トルファン
トルファン →
寝台列車泊
14 → カシュガル
15 カラクリ湖 日帰り
16 カシュガル観光
17 カシュガル 14:35 → 西安 19:00
18 西安 07:30 → 東京 15:55
成田空港→つくば2,300 円
}}
http://kusumotokeiji.zashiki.com/eigo5.htm
*可能性を表す助動詞(可能性が高い順) [#u99c9b35]
1. must 「~に違いない」 (98-100%)
2. will 「~だろう」 (95-100%)
3. would 「~かもしれない」 (90-95%)
4. should/ought to 「たぶん~だ」 (70-90%)
5. can 「~でありうる」 (50-70%)
6. may 「たぶん~だろう」 (30-50%)
7. might 「ひょっとして~かもしれない」 (25-50%)
8. could 「ひょっとして~かもしれない」 (20-40%)
出典
助動詞の<可能性>の度合い|新里式 英語超学習法
航空券は、複数社に見積を依頼し、最も安いところをイントラ上から選択。
ユーザー用のホームディレクトリを作成
$ sudo mkdir /home/morioka
#ユーザーが所属するグループを作成 offside_nowがグループ名
$ sudo groupadd iwate
#グループとホームディレクトリを設定してユーザー追加
$ sudo useradd -g iwate -d /home/morioka morioka
#ユーザーにパスワード設定
$ sudo passwd morioka
Enter new UNIX password: ←パスワード入力
Retype new UNIX password: ←パスワード再入力
passwd: password updated successfully
#contents
*ユーザー管理 [#h802ff66]
**ユーザーの追加 [useradd] [#jbb8b666]
#highlighter(){{
$ sudo useradd -h
使い方: useradd [オプション] LOGIN
useradd -D
useradd -D [オプション]
オプション:
-b, --base-dir BASE_DIR 新アカウントのホームディクトリの
ベースディレクトリ
-c, --comment COMMENT 新アカウントの GECOS フィールド
-d, --home-dir HOME_DIR 新アカウントのホームディレクトリ
-D, --defaults useradd のデフォルト設定を表示または変更
-e, --expiredate EXPIRE_DATE 新アカウントの期限切れ日付
-f, --inactive INACTIVE 新アカウントのパスワード無効化日数
-g, --gid GROUP 新アカウントの主グループの名前または ID
-G, --groups GROUPS 新アカウントの補助グループのリスト
-h, --help このヘルプを表示して終了する
-k, --skel SKEL_DIR 雛型ディレクトリに指定のものを使う
-K, --key KEY=VALUE /etc/login.defs のデフォルトより優先される
-l, --no-log-init ユーザを lastlog, faillog のデータベースに
追加しない
-m, --create-home ユーザのホームディレクトリを作成する
-M, --no-create-home ユーザのホームディレクトリを作成しない
-N, --no-user-group ユーザと同名のグループを作成しない
-o, --non-unique UID が同じユーザの作成を許す
-p, --password PASSWORD 新アカウントの暗号化されたパスワード
-r, --system システムアカウントを作成します
-R, --root CHROOT_DIR chroot するディレクトリ
-s, --shell SHELL 新アカウントのログインシェル
-u, --iud UID 新アカウントのユーザ ID
-U, --user-group ユーザと同じ名前のグループを作成する
-Z, --selinux-user SEUSER SELinux のユーザマッピングに指定した
SEUSER を使う
}}
**ユーザの削除 [userdel] [#bf3e8f46]
#highlighter(){{
$ sudo userdel -h
使い方: userdel [オプション] LOGIN
オプション:
-f, --force 当該ユーザの所有でないファイルも削除する
-h, --help このヘルプを表示して終了する
-r, --remove ホームディレクトリとメールスプールを削除する
-R, --root CHROOT_DIR chroot するディレクトリ
-Z, --selinux-user このユーザの SELinux ユーザマッピングを
全て削除する
}}
**ユーザー一覧 [#j9252ace]
/etc/passwd
#highlighter(){{
・・・
onot:x:1000:1000:onot,,,:/home/onot:/bin/bash
・・・
}}
onot: user name
x: It means password, but "x" is shown in recent system.
1000: User ID
1000: Group ID
Blank columns are arbitrary comments, but users should not change directly.
home/<user name>: It is home directory of each user. If there is not the directory, "/" becomes default directory.
/bin/bash: Default shell setting
** [#kceab2d1]
*tcshrc [#j8a1061d]
t
source ~/.cshrc
source /opt/intel/Compiler/11.1/069/bin/ifortvars.csh intel64
set path=(/usr/local/comsol43b/bin $path)
alias ls 'ls --color=tty'
alias emacs 'emacs -nw'
alias sumire 'ssh onot@172.29.0.219'
alias azisai 'ssh ono@172.29.0.235'
alias scf020 'ssh onot@10.34.83.20'
alias scf023 'ssh onot@10.34.83.23'
*samba [#hb31a7d0]
sambaのinstall
$ sudo apt-get install samba
ユーザ作成/パスワード変更
$ sudo smbpasswd -a onot
ユーザ削除
$ sudo smbpasswd -x onot
ディレクトリの共有
/etc/samba/smb.conf
&color(#ff0000){末尾に追加};
#highlighter(){{
[onot]
path = /home/onot
writable = yes
}}
samba再起動
$ sudo /etc/init.d/samba restart
*intel Compiler(ver 11, 2013とか) [#i5696363]
解答の後インストール。
$ tar zxvf l_fcompxe_2013_sp1.3.174.tgz
cd l_fcompxe_2013_sp1.3.174
$ sudo ./install.sh
下記エラーを表示することがある。
libstdc++ (libstdc++6 を含む)
glibc
libgcc
[[ここ:http://packages.debian.org/stable/base/libstdc++5]]からamd64用とi386用の両方をダウンロードしてくる。
そしてまず、64bit用の方はdpkgをつかってインストールする。
#ref(libstdc++5_3.3.6-28_amd64.deb)
#ref(libstdc++5_3.3.6-28_i386.deb)
$ sudo sudo dpkg -i libstdc++5_3.3.6-28_amd64.deb
32bit用のファイルは、以上インストールだと望みの場所にインストールしてくれないので、パッケージからファイルを取り出してインストールする。まず、
$ sudo dpkg --extract libstdc++5_3.3.6-18_i386.deb ./
で解凍する。
$ cd usr/lib/i386-linux-gnu
$ sudo cp libstdc++.so.5.0.7 /usr/lib32
$ cd /usr/lib32
$ sudo ln -s libstdc++.so.5.0.7 libstdc++.so.5
参考
http://tech.ckme.co.jp/icc.shtml
*technique [#ne51fa27]
**Deletion of '^M' code in line end [#y08e96e1]
#highlighter(){{
$ perl -i.old -npe 's/\r\n/\n/' hogehoge.txt
}}
**Batch erasing of specific data [#sf282c32]
#highlighter(){{
$ find . -name 'angO_CH3-*' -exec rm {} \;
}}
.
"." カレントディレクトリ以下を対象
"-name"
~-name
. カレントディレクトリ以下を対象
-name
findでパターンマッチさせたかったら、find . -name '*.c'というようにパターンを含む引数をクオートで囲む。
-exec {} \;はfindで見つかったそれぞれのファイルを別々にコマンドに渡す。
ちなみに-exec {} + は全部まとめてコマンドを渡すことを意味する。
サンプルコード
#highlighter(){{
$ mkdir test
$ touch test/{a,b}
$ find test -exec echo foo {} \; # Here, backslash means escape.
foo test
foo test/a
foo tess/b
$ find test -exec echo foo {} +
foo tes test/a test/b
}}
*Links [#xc81d4b4]
http://oxynotes.com/
iptablesに関する詳しい説明
ネットワークの設定 (Debian/Linux 系)
現在の設定状況の確認
$ sudo ifconfig -a
DHCPによりIPをもらうと
/etc/network/interfaces
#highlighter(){{
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
}}
固定 IP アドレスの設定(Debian/Linux 系)
/etc/network/interfaces
#highlighter(){{
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.0.10
netmask 255.255.0.0
gateway 192.168.0.1
dns-nameservers 192.168.0.2
}}
$ sudo /etc/init.d/networking stop
$ sudo /etc/init.d/networking start
で反映されるはずなのですが、 最近の Debian (6 だか 7 だか)の起動ファイルは少しおかしいので、 変更が反映されないことがある。
そういうわけで再起動するほうが無難です。
*DDNS(Dynamic Domain Name System)[#l3cbcd66]
[[ieserver:http://ieserver.net/]]を利用する場合について。
以前は[[DiCE:http://www.hi-ho.ne.jp/yoshihiro_e/dice/]]を使用していたが、少し重いので専用スクリプトを利用して更新を行う。専用スクリプトは[[本家:http://ieserver.net/tools.html]]で公開されている。
/var/local/bin
#highlighter(){{
(抜粋)
$CURRENT_IP_FILE = "/var/log/ieserver/current_ip"; ← ログ格納先変更
$LOG_FILE = "/var/log/ieserver/ip_update.log"; ← ログ格納先変更
$DDNS_UPDATE = "https://ieserver.net/cgi-bin/dip.cgi"; ← httpsへ変更
$ACCOUNT = "fedorasrv"; ← ユーザ登録時に入力したサブドメイン名(fedorasrv.dip.jpのfedorasrvにあたる部分)
$DOMAIN = "dip.jp"; ← ユーザ登録時に選択したドメイン名(fedorasrv.dip.jpのdip.jpにあたる部分)
$PASSWORD = "xxxxxxxx"; ← ユーザ登録時に入力したパスワード
}}
専用スクリプトをDLした後、拡張子をtxtからplに変更(ddns-update.pl)
下記の様に設定
このスクリプトにはパスワードが書かれているので、アクセス権を変更する。
$ sudo chmod 700 ddns-update.pl
**crontabで定期実行する [#l2f56e3f]
DDNS更新スクリプトをcrontabを使用して定期的に実行されるように設定しておく。Linuxには指定した時間にコマンド自動実行するcrondというサービスがあり、これに実行して欲しいコマンドや実行日時を管理するコマンドがcrontab。
+crontabを編集
$ crontab -e
初めての実行では、エディタの選択を問われる。
*/10 * * * * /home/[ユーザ名]/scripts/ddns/ddns-update.pl
追加した内容の説明をすると、左から「分」、「時刻」、「日付」、「月」、「曜日」、「実行するコマンド」。この場合ワイルドカードマスクの「*」を指定しているので「毎分/10(つまり10分おき)、毎時、毎日、毎月、曜日毎に /home/[ユーザ名]/scripts/ddns/ddns-update.pl を実行する」という意味になる。
+crontabが正常に動作しているかを syslog を確認
$ sudo tail -f /var/log/syslog
$ sudo crontab -e
sudoで実行しているため、ここで記入する内容は、root権限で実行される。
なので、命令文の前にrootと記入するとエラーとなり、そのたびにメールで通知されてしまう。
*/10 * * * * /usr/local/bin/ddns-update.pl
これで、10分おきにDDNS更新スクリプトが実行される。
$ crontab -l
で現在のcron設定が表示される。cronはユーザー単位で設定されるので、この場合は実行ユーザーのcron設定となる。sudoで行うと、rootの設定が表示される。
設定例があったので、
#highlighter(){{
33 14 * * * 14:33に実行(毎日)
15 06 * * * 6:15に実行(毎日)
0 16 * * * 16:00に実行(毎日)
0 04 * * 1 (月)の午前4:00に実行(毎週)
0,10 19 * * 0,2,3 (日)(火)(水)の19:00と19:10に実行(毎週)
0-10 14 1 * * 1日の14:00から14:10まで1分ごとに実行(毎月)
0 0 1,15 * 1 1日と15日と(月)の 0:00に実行(毎月)
42 4 25 * * 25日の4:42に実行(毎月)
0 21 * * 1-6 (月)〜(土)まで21:00に実行(日曜を除く)
0,10,20,30,40,50 * * * * 10分おきに実行(毎時)
*/10 * * * * 10分おきに実行(毎時)
* 1 * * * 1:00から1:59まで1分おきに実行(毎日)
0 4 * * * 4:00に実行(毎日)
0 */1 * * * 0分に1時間おきに実行(毎時)
0 * * * * 0分に1時間おきに実行(毎時)
2 8-20/3 * * * 8:02,11:02,14:02,17:02,20:02に実行(8:00から20:00まで3時間おきに実行)
30 5 1,15 * * 1日と15日の5:30に実行
}}
1:34
231
334
5:30循環
Furthermore, from a view point of process control and design, increasing the saturation pressure is easier than using an extremely low saturation temperature, which becomes more pronounced at the stage of extension to a continuous flow process.
*Change of Default page [#bc9a2f57]
#highlighter(){{
// Default page name
$defaultpage = 'Notebook'; // Top / Default page
$whatsnew = 'RecentChanges'; // Modified page list
$whatsdeleted = 'RecentDeleted'; // Removeed page list
$interwiki = 'InterWikiName'; // Set InterWiki definition here
$menubar = 'MenuBar'; // Menu
}}
*閲覧認証 [#x20a24cb]
#highlighter(){{
$read_auth_pages = array(
// Regex Groupname or Username
'#PageForAllValidUsers#' => 'valid-user',
'#HogeHoge#' => 'hoge',
'#(NETABARE|NetaBare)#' => 'foo,bar,hoge',
'#linux#' => 'onot',
'#english#'=> 'onot',
'#windows#'=> 'onot',
'#memo#'=> 'onot',
'#document#'=> 'onot',
'#Notebook#'=> 'onot',
'#gnuplot#'=> 'onot',
);
}}
**Debianバージョンアップ [#fe46a5d6]
参考1 https://ameblo.jp/miyou55mane/entry-12435982182.html
参考2
jessieからbusterへ一足飛びで。
始めに、バージョンを確認する。
#highlighter(){{
$uname -a
Linux rounoue 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1 (2016-12-30) x86_64 GNU/Linux
}}
/etc/apt/sources.list を下記のようにに書き換える。
#highlighter(){{
deb http://httpredir.debian.org/debian buster main contrib non-free
deb http://httpredir.debian.org/debian buster-updates main contrib non-free
deb http://security.debian.org/ buster/updates main contrib non-free
deb-src http://security.debian.org/ buster/updates main contrib non-free
}}
下記を実行するも、最後に公開鍵に関するエラーが出る。
#highlighter(){{
$sudo apt update
******
******
W: 以下の鍵 ID に対して利用可能な公開鍵がありません:
112695A0E562B32A
W: 以下の鍵 ID に対して利用可能な公開鍵がありません:
648ACFD622F3D138
NO_PUBKEY DCC9EFBF77E11517
W: 以下の鍵 ID に対して利用可能な公開鍵がありません:
648ACFD622F3D138
}}
そこで、下記を実行すると、updateしてもエラーが出なくなる。
#highlighter(){{
$sudo apt-get update
$sudo apt-get install debian-archive-keyring
}}
さらに下記を実行するとエラーが出るが、ここでは無視。
#hithligter(){{
$sudo apt autoclean
E: 不正な操作 autoclean
$sudo apt autoremo
E: 不正な操作 autoremove
}}
下記を実行すると、アップデートが始まる。
#highlighter(){{
$sudo apt dist-upgrade
}}
ところが、最後にこのようなエラーが出るので、
#highlighter(){{
Errors were encountered while processing:
/var/cache/apt/archives/imagemagick-doc_8%3a6.9.10.23+dfsg-2.1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
新しいメールが /var/mail/**** にあります
}}
#highlighter(){{
apt --fix-broken install
}}
なんか、エラーログを読むとimagemagick-docが悪さをしているようなので、アンインストールしてしまう。
$ sudo apt-get remove imagemagick-doc
再起動の後、バージョンを表示させ、アップデートされていることを確認する。
*SSLの導入 [#w4e983b9]
jessieのままだとインストールできなかったので、Busterにアップデートの後に実行。
#highlighter(){{
$ apt install python-certbot-apache
}}
そして以下のコマンドを実行すると、下記のように HTTPS にするサーバー名の詳細を尋ねてくる。
#highlighter(){{
$ sudo certbot --apache
}}
メールアドレスの入力(多分普段使いのやつでいいはず)
#highlighter(){{
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): ****@gmail.com
}}
利用規約に同意して<Agree>を選択。
#highlighter(){{
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A
}}
メールアドレスを共有してもいいか聞かれるが、ここではNoを選択した。
#highlighter(){{
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o:
}}
#highlighter(){{
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/*********/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/*********/privkey.pem
Your cert will expire on 2019-10-12. To obtain a new or tweaked
version of this certificate in the future, simply run certbot
again. To non-interactively renew *all* of your certificates, run
"certbot renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
}}
この結果、/etc/letsencrypt/live/hoge.example.com/以下に証明書が配置される。
cert.pem…公開鍵を含むSSLサーバ証明書
chain.pem…中間証明書
fullchain.pem…cert.pemとchain.pemが結合されたファイル
privkey.pem…公開鍵に対応する秘密鍵
これらはSSL/TLSを有効化する際に必要となる。
また、証明書の有効期限なども表示されるので確認する。
apache設定
/etc/apache2/sites-available/default-ssl.conf
#highlighter(){{
…
DocumentRoot /var/www/html #ドキュメントルートの設定。
…
SSLEngine on
# A self-signed (snakeoil) certificate can be created by installing
# the ssl-cert package. See
# /usr/share/doc/apache2/README.Debian.gz for more info.
# If both key and certificate are stored in the same file, only the
# SSLCertificateFile directive is needed.
#SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
#SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
SSLCertificateFile /etc/letsencrypt/live/[server domain]/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/[server domain]/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/[server domain]/chain.pem
…
}}
上記で作成した証明書を読み込むように設定する。
iptablesの設定を変更し、https用のポート(443)を開ける。
/etc/iptables/rules.v4
#highlighter(){{
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
}}
設定したファイルを再読み込みする。
#highlighter(){{
$ sudo netfilter-persistent reload
}}
Let's Encryptより発行されるサーバ証明書の有効期間は90日間。
期限が近づくとLet's Encryptよりお知らせのメールが来るので、以下のコマンドにて更新を実行する。
#highlighter(){{
$ sudo certbot renew
}}
有効期間が30日未満の証明書全てが更新される。
また、有効期間に関わらず証明書の更新をする場合、
#highlighter(){{
# certbot renew --force-renewal
}}
リダイレクト設定
http:// でアクセスされた場合に、https:// にリダイレクトさせるように設定。
ドキュメントルートディレクトリに .htaccessをつくり、を下記を記述
#highlighter(){{
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
}}
参考サイト
UbuntuでLet's Encryptの無料SSL/TLSサーバ証明書を取得する
https://chee-s.net/ubuntu%E3%81%A7lets-encrypt%E3%81%AE%E7%84%A1%E6%96%99ssl-tls%E3%82%B5%E3%83%BC%E3%83%90%E8%A8%BC%E6%98%8E%E6%9B%B8%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B
debian で無料のSSL/TLS証明書(Let's Encrypt) を使う
http://pyopyopyo.hatenablog.com/entry/20170906/p1
DebianにLet’s EncryptでSSLを導入する(Apache2.4)
https://enoatu.com/?p=1612
UbuntuへLet’s Encryptをインストール(Certbot編)
https://www.deep-blog.jp/engineer/archives/11632/
httpからhttpsに.htaccessを使ってリダイレクトさせる方法
https://whitebear-seo.com/redirect-https/
*サーバーの安全性を評価 [#d69a11a7]
設定が終わったら、下記サイトにて安全性を評価
https://techblog.timers-inc.com/entry/2016/06/17/174406
終了行:
#highlighter(){{
09
10 東京 02:00 → 上海 04:35
上海 09:05 → トルファン 16:15
Sogdiana Guesthouse泊
11 Sogdiana Guesthouse泊
12 トルファン 00:00 → タクラマカン
13 タクラマカン → トルファン
トルファン →
寝台列車泊
14 → カシュガル
15 カラクリ湖 日帰り
16 カシュガル観光
17 カシュガル 14:35 → 西安 19:00
18 西安 07:30 → 東京 15:55
成田空港→つくば2,300 円
}}
http://kusumotokeiji.zashiki.com/eigo5.htm
*可能性を表す助動詞(可能性が高い順) [#u99c9b35]
1. must 「~に違いない」 (98-100%)
2. will 「~だろう」 (95-100%)
3. would 「~かもしれない」 (90-95%)
4. should/ought to 「たぶん~だ」 (70-90%)
5. can 「~でありうる」 (50-70%)
6. may 「たぶん~だろう」 (30-50%)
7. might 「ひょっとして~かもしれない」 (25-50%)
8. could 「ひょっとして~かもしれない」 (20-40%)
出典
助動詞の<可能性>の度合い|新里式 英語超学習法
航空券は、複数社に見積を依頼し、最も安いところをイントラ上から選択。
ユーザー用のホームディレクトリを作成
$ sudo mkdir /home/morioka
#ユーザーが所属するグループを作成 offside_nowがグループ名
$ sudo groupadd iwate
#グループとホームディレクトリを設定してユーザー追加
$ sudo useradd -g iwate -d /home/morioka morioka
#ユーザーにパスワード設定
$ sudo passwd morioka
Enter new UNIX password: ←パスワード入力
Retype new UNIX password: ←パスワード再入力
passwd: password updated successfully
#contents
*ユーザー管理 [#h802ff66]
**ユーザーの追加 [useradd] [#jbb8b666]
#highlighter(){{
$ sudo useradd -h
使い方: useradd [オプション] LOGIN
useradd -D
useradd -D [オプション]
オプション:
-b, --base-dir BASE_DIR 新アカウントのホームディクトリの
ベースディレクトリ
-c, --comment COMMENT 新アカウントの GECOS フィールド
-d, --home-dir HOME_DIR 新アカウントのホームディレクトリ
-D, --defaults useradd のデフォルト設定を表示または変更
-e, --expiredate EXPIRE_DATE 新アカウントの期限切れ日付
-f, --inactive INACTIVE 新アカウントのパスワード無効化日数
-g, --gid GROUP 新アカウントの主グループの名前または ID
-G, --groups GROUPS 新アカウントの補助グループのリスト
-h, --help このヘルプを表示して終了する
-k, --skel SKEL_DIR 雛型ディレクトリに指定のものを使う
-K, --key KEY=VALUE /etc/login.defs のデフォルトより優先される
-l, --no-log-init ユーザを lastlog, faillog のデータベースに
追加しない
-m, --create-home ユーザのホームディレクトリを作成する
-M, --no-create-home ユーザのホームディレクトリを作成しない
-N, --no-user-group ユーザと同名のグループを作成しない
-o, --non-unique UID が同じユーザの作成を許す
-p, --password PASSWORD 新アカウントの暗号化されたパスワード
-r, --system システムアカウントを作成します
-R, --root CHROOT_DIR chroot するディレクトリ
-s, --shell SHELL 新アカウントのログインシェル
-u, --iud UID 新アカウントのユーザ ID
-U, --user-group ユーザと同じ名前のグループを作成する
-Z, --selinux-user SEUSER SELinux のユーザマッピングに指定した
SEUSER を使う
}}
**ユーザの削除 [userdel] [#bf3e8f46]
#highlighter(){{
$ sudo userdel -h
使い方: userdel [オプション] LOGIN
オプション:
-f, --force 当該ユーザの所有でないファイルも削除する
-h, --help このヘルプを表示して終了する
-r, --remove ホームディレクトリとメールスプールを削除する
-R, --root CHROOT_DIR chroot するディレクトリ
-Z, --selinux-user このユーザの SELinux ユーザマッピングを
全て削除する
}}
**ユーザー一覧 [#j9252ace]
/etc/passwd
#highlighter(){{
・・・
onot:x:1000:1000:onot,,,:/home/onot:/bin/bash
・・・
}}
onot: user name
x: It means password, but "x" is shown in recent system.
1000: User ID
1000: Group ID
Blank columns are arbitrary comments, but users should not change directly.
home/<user name>: It is home directory of each user. If there is not the directory, "/" becomes default directory.
/bin/bash: Default shell setting
** [#kceab2d1]
*tcshrc [#j8a1061d]
t
source ~/.cshrc
source /opt/intel/Compiler/11.1/069/bin/ifortvars.csh intel64
set path=(/usr/local/comsol43b/bin $path)
alias ls 'ls --color=tty'
alias emacs 'emacs -nw'
alias sumire 'ssh onot@172.29.0.219'
alias azisai 'ssh ono@172.29.0.235'
alias scf020 'ssh onot@10.34.83.20'
alias scf023 'ssh onot@10.34.83.23'
*samba [#hb31a7d0]
sambaのinstall
$ sudo apt-get install samba
ユーザ作成/パスワード変更
$ sudo smbpasswd -a onot
ユーザ削除
$ sudo smbpasswd -x onot
ディレクトリの共有
/etc/samba/smb.conf
&color(#ff0000){末尾に追加};
#highlighter(){{
[onot]
path = /home/onot
writable = yes
}}
samba再起動
$ sudo /etc/init.d/samba restart
*intel Compiler(ver 11, 2013とか) [#i5696363]
解答の後インストール。
$ tar zxvf l_fcompxe_2013_sp1.3.174.tgz
cd l_fcompxe_2013_sp1.3.174
$ sudo ./install.sh
下記エラーを表示することがある。
libstdc++ (libstdc++6 を含む)
glibc
libgcc
[[ここ:http://packages.debian.org/stable/base/libstdc++5]]からamd64用とi386用の両方をダウンロードしてくる。
そしてまず、64bit用の方はdpkgをつかってインストールする。
#ref(libstdc++5_3.3.6-28_amd64.deb)
#ref(libstdc++5_3.3.6-28_i386.deb)
$ sudo sudo dpkg -i libstdc++5_3.3.6-28_amd64.deb
32bit用のファイルは、以上インストールだと望みの場所にインストールしてくれないので、パッケージからファイルを取り出してインストールする。まず、
$ sudo dpkg --extract libstdc++5_3.3.6-18_i386.deb ./
で解凍する。
$ cd usr/lib/i386-linux-gnu
$ sudo cp libstdc++.so.5.0.7 /usr/lib32
$ cd /usr/lib32
$ sudo ln -s libstdc++.so.5.0.7 libstdc++.so.5
参考
http://tech.ckme.co.jp/icc.shtml
*technique [#ne51fa27]
**Deletion of '^M' code in line end [#y08e96e1]
#highlighter(){{
$ perl -i.old -npe 's/\r\n/\n/' hogehoge.txt
}}
**Batch erasing of specific data [#sf282c32]
#highlighter(){{
$ find . -name 'angO_CH3-*' -exec rm {} \;
}}
.
"." カレントディレクトリ以下を対象
"-name"
~-name
. カレントディレクトリ以下を対象
-name
findでパターンマッチさせたかったら、find . -name '*.c'というようにパターンを含む引数をクオートで囲む。
-exec {} \;はfindで見つかったそれぞれのファイルを別々にコマンドに渡す。
ちなみに-exec {} + は全部まとめてコマンドを渡すことを意味する。
サンプルコード
#highlighter(){{
$ mkdir test
$ touch test/{a,b}
$ find test -exec echo foo {} \; # Here, backslash means escape.
foo test
foo test/a
foo tess/b
$ find test -exec echo foo {} +
foo tes test/a test/b
}}
*Links [#xc81d4b4]
http://oxynotes.com/
iptablesに関する詳しい説明
ネットワークの設定 (Debian/Linux 系)
現在の設定状況の確認
$ sudo ifconfig -a
DHCPによりIPをもらうと
/etc/network/interfaces
#highlighter(){{
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
}}
固定 IP アドレスの設定(Debian/Linux 系)
/etc/network/interfaces
#highlighter(){{
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.0.10
netmask 255.255.0.0
gateway 192.168.0.1
dns-nameservers 192.168.0.2
}}
$ sudo /etc/init.d/networking stop
$ sudo /etc/init.d/networking start
で反映されるはずなのですが、 最近の Debian (6 だか 7 だか)の起動ファイルは少しおかしいので、 変更が反映されないことがある。
そういうわけで再起動するほうが無難です。
*DDNS(Dynamic Domain Name System)[#l3cbcd66]
[[ieserver:http://ieserver.net/]]を利用する場合について。
以前は[[DiCE:http://www.hi-ho.ne.jp/yoshihiro_e/dice/]]を使用していたが、少し重いので専用スクリプトを利用して更新を行う。専用スクリプトは[[本家:http://ieserver.net/tools.html]]で公開されている。
/var/local/bin
#highlighter(){{
(抜粋)
$CURRENT_IP_FILE = "/var/log/ieserver/current_ip"; ← ログ格納先変更
$LOG_FILE = "/var/log/ieserver/ip_update.log"; ← ログ格納先変更
$DDNS_UPDATE = "https://ieserver.net/cgi-bin/dip.cgi"; ← httpsへ変更
$ACCOUNT = "fedorasrv"; ← ユーザ登録時に入力したサブドメイン名(fedorasrv.dip.jpのfedorasrvにあたる部分)
$DOMAIN = "dip.jp"; ← ユーザ登録時に選択したドメイン名(fedorasrv.dip.jpのdip.jpにあたる部分)
$PASSWORD = "xxxxxxxx"; ← ユーザ登録時に入力したパスワード
}}
専用スクリプトをDLした後、拡張子をtxtからplに変更(ddns-update.pl)
下記の様に設定
このスクリプトにはパスワードが書かれているので、アクセス権を変更する。
$ sudo chmod 700 ddns-update.pl
**crontabで定期実行する [#l2f56e3f]
DDNS更新スクリプトをcrontabを使用して定期的に実行されるように設定しておく。Linuxには指定した時間にコマンド自動実行するcrondというサービスがあり、これに実行して欲しいコマンドや実行日時を管理するコマンドがcrontab。
+crontabを編集
$ crontab -e
初めての実行では、エディタの選択を問われる。
*/10 * * * * /home/[ユーザ名]/scripts/ddns/ddns-update.pl
追加した内容の説明をすると、左から「分」、「時刻」、「日付」、「月」、「曜日」、「実行するコマンド」。この場合ワイルドカードマスクの「*」を指定しているので「毎分/10(つまり10分おき)、毎時、毎日、毎月、曜日毎に /home/[ユーザ名]/scripts/ddns/ddns-update.pl を実行する」という意味になる。
+crontabが正常に動作しているかを syslog を確認
$ sudo tail -f /var/log/syslog
$ sudo crontab -e
sudoで実行しているため、ここで記入する内容は、root権限で実行される。
なので、命令文の前にrootと記入するとエラーとなり、そのたびにメールで通知されてしまう。
*/10 * * * * /usr/local/bin/ddns-update.pl
これで、10分おきにDDNS更新スクリプトが実行される。
$ crontab -l
で現在のcron設定が表示される。cronはユーザー単位で設定されるので、この場合は実行ユーザーのcron設定となる。sudoで行うと、rootの設定が表示される。
設定例があったので、
#highlighter(){{
33 14 * * * 14:33に実行(毎日)
15 06 * * * 6:15に実行(毎日)
0 16 * * * 16:00に実行(毎日)
0 04 * * 1 (月)の午前4:00に実行(毎週)
0,10 19 * * 0,2,3 (日)(火)(水)の19:00と19:10に実行(毎週)
0-10 14 1 * * 1日の14:00から14:10まで1分ごとに実行(毎月)
0 0 1,15 * 1 1日と15日と(月)の 0:00に実行(毎月)
42 4 25 * * 25日の4:42に実行(毎月)
0 21 * * 1-6 (月)〜(土)まで21:00に実行(日曜を除く)
0,10,20,30,40,50 * * * * 10分おきに実行(毎時)
*/10 * * * * 10分おきに実行(毎時)
* 1 * * * 1:00から1:59まで1分おきに実行(毎日)
0 4 * * * 4:00に実行(毎日)
0 */1 * * * 0分に1時間おきに実行(毎時)
0 * * * * 0分に1時間おきに実行(毎時)
2 8-20/3 * * * 8:02,11:02,14:02,17:02,20:02に実行(8:00から20:00まで3時間おきに実行)
30 5 1,15 * * 1日と15日の5:30に実行
}}
1:34
231
334
5:30循環
Furthermore, from a view point of process control and design, increasing the saturation pressure is easier than using an extremely low saturation temperature, which becomes more pronounced at the stage of extension to a continuous flow process.
*Change of Default page [#bc9a2f57]
#highlighter(){{
// Default page name
$defaultpage = 'Notebook'; // Top / Default page
$whatsnew = 'RecentChanges'; // Modified page list
$whatsdeleted = 'RecentDeleted'; // Removeed page list
$interwiki = 'InterWikiName'; // Set InterWiki definition here
$menubar = 'MenuBar'; // Menu
}}
*閲覧認証 [#x20a24cb]
#highlighter(){{
$read_auth_pages = array(
// Regex Groupname or Username
'#PageForAllValidUsers#' => 'valid-user',
'#HogeHoge#' => 'hoge',
'#(NETABARE|NetaBare)#' => 'foo,bar,hoge',
'#linux#' => 'onot',
'#english#'=> 'onot',
'#windows#'=> 'onot',
'#memo#'=> 'onot',
'#document#'=> 'onot',
'#Notebook#'=> 'onot',
'#gnuplot#'=> 'onot',
);
}}
**Debianバージョンアップ [#fe46a5d6]
参考1 https://ameblo.jp/miyou55mane/entry-12435982182.html
参考2
jessieからbusterへ一足飛びで。
始めに、バージョンを確認する。
#highlighter(){{
$uname -a
Linux rounoue 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1 (2016-12-30) x86_64 GNU/Linux
}}
/etc/apt/sources.list を下記のようにに書き換える。
#highlighter(){{
deb http://httpredir.debian.org/debian buster main contrib non-free
deb http://httpredir.debian.org/debian buster-updates main contrib non-free
deb http://security.debian.org/ buster/updates main contrib non-free
deb-src http://security.debian.org/ buster/updates main contrib non-free
}}
下記を実行するも、最後に公開鍵に関するエラーが出る。
#highlighter(){{
$sudo apt update
******
******
W: 以下の鍵 ID に対して利用可能な公開鍵がありません:
112695A0E562B32A
W: 以下の鍵 ID に対して利用可能な公開鍵がありません:
648ACFD622F3D138
NO_PUBKEY DCC9EFBF77E11517
W: 以下の鍵 ID に対して利用可能な公開鍵がありません:
648ACFD622F3D138
}}
そこで、下記を実行すると、updateしてもエラーが出なくなる。
#highlighter(){{
$sudo apt-get update
$sudo apt-get install debian-archive-keyring
}}
さらに下記を実行するとエラーが出るが、ここでは無視。
#hithligter(){{
$sudo apt autoclean
E: 不正な操作 autoclean
$sudo apt autoremo
E: 不正な操作 autoremove
}}
下記を実行すると、アップデートが始まる。
#highlighter(){{
$sudo apt dist-upgrade
}}
ところが、最後にこのようなエラーが出るので、
#highlighter(){{
Errors were encountered while processing:
/var/cache/apt/archives/imagemagick-doc_8%3a6.9.10.23+dfsg-2.1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
新しいメールが /var/mail/**** にあります
}}
#highlighter(){{
apt --fix-broken install
}}
なんか、エラーログを読むとimagemagick-docが悪さをしているようなので、アンインストールしてしまう。
$ sudo apt-get remove imagemagick-doc
再起動の後、バージョンを表示させ、アップデートされていることを確認する。
*SSLの導入 [#w4e983b9]
jessieのままだとインストールできなかったので、Busterにアップデートの後に実行。
#highlighter(){{
$ apt install python-certbot-apache
}}
そして以下のコマンドを実行すると、下記のように HTTPS にするサーバー名の詳細を尋ねてくる。
#highlighter(){{
$ sudo certbot --apache
}}
メールアドレスの入力(多分普段使いのやつでいいはず)
#highlighter(){{
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): ****@gmail.com
}}
利用規約に同意して<Agree>を選択。
#highlighter(){{
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A
}}
メールアドレスを共有してもいいか聞かれるが、ここではNoを選択した。
#highlighter(){{
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o:
}}
#highlighter(){{
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/*********/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/*********/privkey.pem
Your cert will expire on 2019-10-12. To obtain a new or tweaked
version of this certificate in the future, simply run certbot
again. To non-interactively renew *all* of your certificates, run
"certbot renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
}}
この結果、/etc/letsencrypt/live/hoge.example.com/以下に証明書が配置される。
cert.pem…公開鍵を含むSSLサーバ証明書
chain.pem…中間証明書
fullchain.pem…cert.pemとchain.pemが結合されたファイル
privkey.pem…公開鍵に対応する秘密鍵
これらはSSL/TLSを有効化する際に必要となる。
また、証明書の有効期限なども表示されるので確認する。
apache設定
/etc/apache2/sites-available/default-ssl.conf
#highlighter(){{
…
DocumentRoot /var/www/html #ドキュメントルートの設定。
…
SSLEngine on
# A self-signed (snakeoil) certificate can be created by installing
# the ssl-cert package. See
# /usr/share/doc/apache2/README.Debian.gz for more info.
# If both key and certificate are stored in the same file, only the
# SSLCertificateFile directive is needed.
#SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
#SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
SSLCertificateFile /etc/letsencrypt/live/[server domain]/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/[server domain]/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/[server domain]/chain.pem
…
}}
上記で作成した証明書を読み込むように設定する。
iptablesの設定を変更し、https用のポート(443)を開ける。
/etc/iptables/rules.v4
#highlighter(){{
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
}}
設定したファイルを再読み込みする。
#highlighter(){{
$ sudo netfilter-persistent reload
}}
Let's Encryptより発行されるサーバ証明書の有効期間は90日間。
期限が近づくとLet's Encryptよりお知らせのメールが来るので、以下のコマンドにて更新を実行する。
#highlighter(){{
$ sudo certbot renew
}}
有効期間が30日未満の証明書全てが更新される。
また、有効期間に関わらず証明書の更新をする場合、
#highlighter(){{
# certbot renew --force-renewal
}}
リダイレクト設定
http:// でアクセスされた場合に、https:// にリダイレクトさせるように設定。
ドキュメントルートディレクトリに .htaccessをつくり、を下記を記述
#highlighter(){{
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
}}
参考サイト
UbuntuでLet's Encryptの無料SSL/TLSサーバ証明書を取得する
https://chee-s.net/ubuntu%E3%81%A7lets-encrypt%E3%81%AE%E7%84%A1%E6%96%99ssl-tls%E3%82%B5%E3%83%BC%E3%83%90%E8%A8%BC%E6%98%8E%E6%9B%B8%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B
debian で無料のSSL/TLS証明書(Let's Encrypt) を使う
http://pyopyopyo.hatenablog.com/entry/20170906/p1
DebianにLet’s EncryptでSSLを導入する(Apache2.4)
https://enoatu.com/?p=1612
UbuntuへLet’s Encryptをインストール(Certbot編)
https://www.deep-blog.jp/engineer/archives/11632/
httpからhttpsに.htaccessを使ってリダイレクトさせる方法
https://whitebear-seo.com/redirect-https/
*サーバーの安全性を評価 [#d69a11a7]
設定が終わったら、下記サイトにて安全性を評価
https://techblog.timers-inc.com/entry/2016/06/17/174406
ページ名: