pam_autologin

提供: ArchWiki
2022年7月18日 (月) 18:17時点におけるAshMyzk (トーク | 投稿記録)による版 (ページの作成:「{{DISPLAYTITLE:pam_autologin}} Category:認証 en:Pam autologin [https://github.com/msharov/pam_autologin pam_autologin] は自動的にユーザにログイン…」)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
ナビゲーションに移動 検索に移動

pam_autologin は自動的にユーザにログインします。他の自動ログインメソッドと異なり、このモジュールはパスワードを保存し、そのパスワードを通常の認証プロセスで使用します。パスワードは、暗号化されたホームディレクトリをマウントするために pam_mount で使用したり、ログインキーリングをアンロックするために GNOME/Keyring で使用したりすることができます。

インストール

pam_autologinAUR パッケージをインストールしてください。

このモジュールを特定のアプリケーションに対して有効化するには、/etc/pam.d/ 内の設定ファイルを編集してください。例えば:

/etc/pam.d/login
#%PAM-1.0
auth    required pam_autologin.so
auth    include  system-local-login
account include  system-local-login
session include  system-local-login

ユーザ名とパスワードをセットできるようにするために、この自動ログインの行は auth セクションの先頭モジュールである必要があります。他のモジュールが前の行にありユーザ名を必要とする場合、パスワードを要求するプロンプトが表示されます。

ログアウトする時は他のアカウントにログイン場合がほとんどでしょうから、自動ログインは各 TTY で1回だけ行われます。このモジュールは /var/log/wtmp のパスを探索し、最後の起動以降の TTY でのログインを調べます。毎回自動ログインするには、always オプションを指定できます:

auth required pam_autologin.so always

ログインプロセスが PAM ベースのアプリケーション(例えばディスプレイマネージャ)や、loginxAUR のような getty/ログインの組み合わせにより実行される場合、設定は必要ありません。しかし、プレーンな agetty は PAM アプリケーションではありませんので、常にユーザ名を要求するプロンプトを表示します。これに対して自動ログインを有効化するには、すぐにログインを開始するようにするために getty に --skip-login オプションを渡す必要があります。以下のように、systemd の getty@.service に対するドロップインファイルを追加してください:

/etc/systemd/system/getty@.service.d/override.conf
ExecStart=
ExecStart=-/sbin/agetty --skip-login - $TERM

設定

設定ファイルを作成して、自動ログインモジュールが次回のログインを保存するようにしてください:

# touch /etc/security/autologin.conf

再起動してください。次回のログインが保存されるという旨のメッセージが表示されるはずです。通常通りログインしてください。そして、再び再起動してください。自動でログインするはずです。

自動ログインを停止したい場合、設定ファイルを削除してください:

# shred -u /etc/security/autologin.conf

ファイルのリンクを解除する前に、shred ユーティリティを使ってファイルをゼロアウトしてください。このファイルにはユーザ名とパスワードが含まれており、ファイルを単に削除しただけではデータがストレージの未割り当て領域に取り残される可能性があります。ハッカーはそのデータを発見できる可能性があります。このファイルはランダムな鍵によって難読化されてはいますが、自動ログインモジュールがそのファイルを読み出せるようにするために鍵はそのファイル自体に保存されなければならないため、難読化されてはいますが、保護されているわけではありません。

セキュリティ

この記事またはセクションの正確性には問題があります。
理由: The section addresses the topic rather single-sided, expanding on the same points as the module repo, when it should refer to it and address Arch relevant points instead. Links to wikipedia:Access control#Computer security,Security, Data-at-rest encryption, alternatives like w:Security token, Smartcards may be useful. (議論: トーク:Pam autologin#)

Autologin is frequently and undeservedly derided as insecure, so a few observations on the subject seem warranted. To decide whether it is insecure for you, you must ask "secure from what?" For the vast majority of users there are only two kind of threats to be concerned about: malware and theft.

Malware and various remote hacking threats come in through bugs in programs running under user privileges, usually the web browser. The login information saved by this module is only readable by root, so malware would first require a privilege escalation vulnerability. Malware running under root privileges can already get your password by recording your login with a keylogger, so autologin will not decrease your security in this situation.

Theft is the other common threat, and the one where autologin does indeed allow the thief full access to everything. But just how big a concern is theft for you? If you are using a desktop at home, the chances of it being stolen are negligible in most places. Contrary to what you constantly hear on the news, burglaries are uncommon outside the big cities. You are especially safe if you work at home; burglars dislike dealing with people. Enable autologin on the desktop and you are pretty much as secure as you were without it, and the convenience of not typing your password may well outweigh any remaining concerns.

Laptops, on the other hand, are much more likely to be stolen. Anytime you leave it unattended in public you should not be surprized to find it gone when you return. Using autologin on a laptop would usually not be a good idea, but a laptop is not always used in public. If you only use your laptop at home, it is no more vulnerable to theft than a desktop would be, and using autologin on it would be just as safe. If you use your laptop outside the home, but infrequently, then you could just disable autologin before leaving the house. This way you can still keep everything encrypted, while still having the convenience of autologin when in a safe location.

As you can see, other than on laptops carried in public, using pam_autologin is quite safe and you should not be afraid to do so.

参照