FreeBSDでパスワードログインを無効にするさまざまな方法

FreeBSDでパスワードログインを無効にするさまざまな方法

違いは何ですか:

pw lock <user>

そして

pw mod user <user> -w no

どちらも同じことを行います。パスワードベースのログインを無効にしますが、なぜ他のものよりも1つを選択するのですか?

ベストアンサー1

~からpw(8) マンページ(プログラムに関する質問があるときは、常に最初に見ておくべき場所です!man pw

USER LOCKING
     The pw utility supports a simple password locking mechanism for users; it
     works by prepending the string `*LOCKED*' to the beginning   of the pass-
     word field   in master.passwd to prevent successful authentication.

     The lock and unlock commands take a user name or uid of the account to
     lock or unlock, respectively.  The   -V, -C, and -q options as described
     above are accepted   by these commands.

そして

(about部分をusermod意味するようですmod user

 -w   method     The -w option selects the default method used to set pass-
     words for newly created user accounts.  method is one of:

       no  disable login on newly created accounts
       yes     force the password to be the account name
       none    force a blank password
       random  generate a random password

     The `random' or `no' methods are the most secure; in the
     former case, pw generates a password and prints it to std-
     out, which is suitable when users are issued passwords
     rather than being allowed to select their own (possibly
     poorly chosen) password.  The `no' method requires that the
     superuser use passwd(1) to render the account accessible
     with a password.

したがって、をlock使用して復元できます。unlockusermod <user> -w no削除パスワードと管理者を設定する必要があります新しい1を選択してユーザーに通知します(信頼できないメディアを介して転送することが含まれる場合があります)。

おすすめ記事