SSH:更改使用者 shell 後“權限被拒絕”

SSH:更改使用者 shell 後“權限被拒絕”

我有一個 SSH 伺服器在我的 Raspberry PI 上運行,並帶有 ALARM(最新)。我的用戶“gitroot”意味著使用 git-shell。但是,當我/usr/bin/git-shell在 中設定 gitroot 的 shell時/etc/passwd,我無法再使用該使用者登入。su - gitroot按預期工作。當我將 shell 更改為 時/bin/bash,我可以透過 ssh 以 gitroot 身分登入。

/usr/bin/git-shell和的權限/bin/bash是一樣的。我嘗試更改密碼,但沒有改變任何內容。輸出來自journalctl -f

Jul 23 09:05:27 netberry sshd[4213]: pam_unix(sshd:auth): authentication failure;logname= uid=0 euid=0 tty=ssh ruser= rhost=localhost.localdomai...r=gitroot
Jul 23 09:05:40 netberry sshd[4213]: Failed password for gitroot from 127.0.0.1 port 51969 ssh2
Jul 23 09:07:25 netberry sshd[4213]: Connection closed by 127.0.0.1 [preauth]
Jul 23 09:07:29 netberry sshd[4222]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=localhost.localdomai...r=gitroot
Jul 23 09:07:43 netberry sshd[4222]: Failed password for gitroot from 127.0.0.1 port 51970 ssh2
Jul 23 09:08:07 netberry sshd[4222]: Failed password for gitroot from 127.0.0.1 port 51970 ssh2
Jul 23 09:08:08 netberry sshd[4222]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=localhost.localdomai...r=gitroot
Jul 23 09:08:10 netberry sshd[4222]: Failed password for gitroot from 127.0.0.1 port 51970 ssh2
Jul 23 09:08:10 netberry sshd[4222]: Connection closed by 127.0.0.1 [preauth]

該日誌顯示多次嘗試從主機本身透過 ssh 以 gitroot 身分登入(我剛剛ssh gitroot@localhost在控制台中輸入)。

答案1

正如評論中提到的,您應該添加/usr/bin/git-shell/etc/shells.

相關內容