ホームディレクトリのないアカウントでSSHにアクセスする

ホームディレクトリのないアカウントでSSHにアクセスする

私のフォローアップとしてより早い問題は、次のようにローカルユーザーアカウントを作成することにしました。

adduser --system --no-create-home USERNAME

これで、ローカルユーザーが利用できることを願っていますssh。私が理解したところによると、そのssh仕組みは次のとおりです。

2台のコンピュータがあるとしましょう。αそしてベータ)。

  • ~からα機械:ssh user@beta
  • アルパス公開鍵は次の場所~/.ssh/authorized_keysに表示されます。ベータマシン。
  • アルパス秘密鍵が次に/~/.ssh表示されます。αマシン。

今実装する予定です。家がないユーザーのため。それでは私がadduser入るとしましょう。ベータユーザーが居ないコンピュータにSSHで接続できますか?ベータ~からα

ベストアンサー1

~/.ssh/sshd着信ユーザーの公開鍵を見つけるためのデフォルトの場所です。のディレクティブをsshd変更して、検索する場所とファイルを整理できます。私の現在の外観は次のとおりです。AuthorizedKeysFile/etc/ssh/sshd_config

AuthorizedKeysFile     %h/.ssh/authorized_keys

マニュアルsshd_configページに詳細が記載されています。

 AuthorizedKeysFile
     Specifies the file that contains the public keys that can be used for user authentication.  The format is
     described in the AUTHORIZED_KEYS FILE FORMAT section of sshd(8).  AuthorizedKeysFile may contain tokens of
     the form %T which are substituted during connection setup.  The following tokens are defined: %% is
     replaced by a literal '%', %h is replaced by the home directory of the user being authenticated, and %u is
     replaced by the username of that user.  After expansion, AuthorizedKeysFile is taken to be an absolute
     path or one relative to the user's home directory.  Multiple files may be listed, separated by whitespace.
     The default is “.ssh/authorized_keys .ssh/authorized_keys2”.

sshdユーザーファイルに対する権限はauthorized_key非常に特別です。このオプションを設定してログインに問題が発生した場合は、ログに慎重に注意することをお勧めします。

おすすめ記事