![能夠 su 進入新建立的帳戶,但直接 ssh 不起作用](https://rvso.com/image/170668/%E8%83%BD%E5%A4%A0%20su%20%E9%80%B2%E5%85%A5%E6%96%B0%E5%BB%BA%E7%AB%8B%E7%9A%84%E5%B8%B3%E6%88%B6%EF%BC%8C%E4%BD%86%E7%9B%B4%E6%8E%A5%20ssh%20%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8.png)
我在這裡需要一些指導。我在 Linux 伺服器上建立了一個新帳戶,遇到了一個奇怪的問題。新帳戶無法登錄,甚至無法 ssh test@localhost 我能夠以 root 和其他帳戶身份進行 ssh。當我以另一個帳戶登入時,我嘗試了 su test,它提示我輸入測試帳戶的密碼,然後我就可以進入。
[admin1@server]$ su test
Password:
[test@server]$ exit
exit
[admin1@server]$ ssh test@localhost
test@localhost's password:
Permission denied, please try again.
[admin1@server test]$ pwd
/home/test
[admin1@server test]$ sudo cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
[admin1@server test]$
[admin1@server log]$ sudo cat messages | grep test
Apr 8 12:31:40 server su: (to test) admin1 on pts/0
Apr 8 12:31:40 server su: (to test) admin1 on pts/0
[admin1@server log]$
[admin1@server etc]$ sudo cat sshd_config
[admin1@server etc]$
順便說一句,admin1@server 正在工作。
答案1
可能您已經PermitRootLogin prohibit-password
啟用了/etc/ssh/sshd_config
.要么切換到該yes
系統,要么(更好)使用 RSA 密鑰登入該系統。