sshでUbuntuにログインする時にパスワード入力のところで固まりやすくなる場合の対処

Ubuntuの場合のみ

sshでログインする時に、/etc/update-motd.d にある処理を行うようになっている。ここのファイルで必要の無いものを消すか

/etc/pam.d/sshdで

session optional pam_motd.so motd=/run/motd.dynamic
session optional pam_motd.so noupdate

をコメントアウトするとupdate-motd.dの処理を行わなくなる。

/etc/hosts $HOME/.ssh/config /etc/resolv.conf

をいじってもダメな場合は試してみると良い

参考:

Ubuntu ログイン時のMotDを止める Ubuntuでmotdメッセージをいじる Long wait time on login sshの接続確立が遅い場合の対処方法 sshの接続(ログイン時)に時間がかかる

Ubuntu 18.04LTSでnslookupは出来るのにpingが出来ない

nslookup thoz.org
Server:     xxx.xxx.xxx.xx
Address:    xxx.xxx.xxx.xx#xx

Non-authoritative answer:
Name:   thoz.org
Address: xxx.xxx.xxx.xxx

みたいな感じで成功するけど、

ping thoz.org
ping: thoz.org: Name or service not known

となってpingしてくれないケース

AskUbuntuに同じ質問があって、回答があった。/etc/nsswitch.confをいじると良いらしい。自分のubuntuでは

hosts: files

となっていたので

hosts: files dns

と変更すれば治った。 linux豆知識によると、nsswitch.confは名前解決を行う優先順位を指定するファイルなので、そこでファイルしか指定してないと、そりゃdns参照してくれないよねという話であった。

参考:nslookup finds id, but ping doesnt

Ubuntu 18.04LTSではタイムゾーンがUTCになっている

Ubuntu 18.04でOSインストール時にタイムゾーン設定が無いのに気づかずに、ずっと使ってた。

$ timedatectl
                      Local time: 日 2020-02-16 22:53:25 UTC
                  Universal time: 日 2020-02-16 22:53:25 UTC
                        RTC time: 日 2020-02-16 22:53:25
                       Time zone: Etc/UTC (UTC, +0000)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

タイムゾーンにAsia/Tokyoがあるか確認

$ timedatectl list-timezones | grep -i tokyo 
Asia/Tokyo

Asia/Tokyoにタイムゾーン設定

$ timedatectl set-timezone Asia/Tokyo

cronの時刻設定はタイムゾーン変更してもそのままUTCのままなので、cronサービスを再起動する

$ service cron restart

以上でタイムゾーンの変更作業は完了。タイムゾーン変更しただけだと、トラブるのでメモ

参考: ubuntu 18.04 時刻とタイムゾーン設定 タイムゾーンを変更したら Cron の実施時刻がずれたので修正した作業メモ