店員女兒在椅子上睡得很香很可愛
2020年5月22日 星期五
2020年5月19日 星期二
ssh免密碼登入
SSH免密碼登入設定小細節
關於免密碼登入這件事網路上很多教學了,但有時照著做,伺服器仍會跟你要密碼,這是因為有些權限沒有設定好的關係。
根據sshd的man page,這裡有提到一些重點:
~/.ssh/
This directory is the default location for all user-specific con-
figuration and authentication information. There is no general
requirement to keep the entire contents of this directory secret,
but the recommended permissions are read/write/execute for the
user, and not accessible by others.
~/.ssh/authorized_keys
Lists the public keys (DSA, ECDSA, Ed25519, RSA) that can be used
for logging in as this user. The format of this file is de-
scribed above. The content of the file is not highly sensitive,
but the recommended permissions are read/write for the user, and
not accessible by others.
If this file, the _~/.ssh_ directory, or the user's home directory
are writable by other users, then the file could be modified or
replaced by unauthorized users. In this case, **sshd** will not al-
low it to be used unless the **StrictModes** option has been set to
"no".
也就是說,ssh相關的目錄要做好以下設定才行:
$HOME/.ssh/
權限要設定成700
$HOME/.ssh/authorized_keys
權限設定成600
$HOME
預設的設定通常正確,但要留意不能讓其他user能寫
如果違背以上限制,還是會被要密碼的~
訂閱:
文章 (Atom)