大网数据广告活动
服务器运维问答

Cannot log into ubuntu with standard account with ssh

· 52CE 我爱测

On a ubuntu 16.04 server (OVH public cloud) I create a standard account : adduser www I add my public key into .ssh/authorized_keys Then I do a ssh www@myserver And I got : Please login as the user "ubuntu" rather than the user "…

问题原文

原帖链接 · Eric · CC BY-SA 3.0

On a ubuntu 16.04 server (OVH public cloud)

I create a standard account :

adduser www

I add my public key into .ssh/authorized_keys Then I do a

ssh www@myserver

And I got :

Please login as the user "ubuntu" rather than the user "root"

I was expecting "www" instead of "root", but not : strange.

The public key is correctly read because before setting it I got permission denied. In fact, the login process begins correctly because in auth.log I got :

May 14 09:12:42 serveur-1 sshd[16069]: Accepted publickey for www from 86.252.248.254 port 38686 ssh2: RSA SHA256:+X9bylqQgjb/bjeLL8P0AVx0WFJZloWXacKPE43oD4E
May 14 09:12:42 serveur-1 sshd[16069]: pam_unix(sshd:session): session opened for user www by (uid=0)
May 14 09:12:42 serveur-1 systemd: pam_unix(systemd-user:session): session opened for user www by (uid=0)
May 14 09:12:42 serveur-1 systemd-logind[1291]: New session 27 of user www.
May 14 09:12:52 serveur-1 sshd[16129]: Received disconnect from 86.252.248.254 port 38686:11: disconnected by user
May 14 09:12:52 serveur-1 sshd[16129]: Disconnected from 86.252.248.254 port 38686
May 14 09:12:52 serveur-1 sshd[16069]: pam_unix(sshd:session): session closed for user www
May 14 09:12:52 serveur-1 systemd-logind[1291]: Removed session 27.

I know, I should do a ssh ubuntu@myserver and then use sudo, but I want to understand why I have this behaviour and how can I disable it to be able to log in a standard account directly with ssh

Any idea ?

已采纳解答

原帖链接 · Eric · CC BY-SA 3.0

I found the real resaon : I copied my authorized_keys from root to the standard account, there was :

no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user \"centos\" rather than the user \"root\".';echo;sleep 10" ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2WA6Iao6j6yLs

In it.

So come the message...

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-05-14)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。