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

Temporarily disable ssh public key authentication from client

· 52CE 我爱测

Is there a way to temporarily disable public key authentication when ssh'ing, and use password authentication instead? I currently want to access remote server, but I'm using another laptop, not mine. Browsing that link , I found…

问题原文

原帖链接 · Nsukami _ · CC BY-SA 3.0

Is there a way to temporarily disable public key authentication when ssh'ing, and use password authentication instead?

I currently want to access remote server, but I'm using another laptop, not mine.

Browsing that link, I found that the command ssh -o PreferredAuthentications=keyboard-interactive -o PubkeyAuthentication=no host1.example.org doesn't work everywhere. And yes, it doesn't work for me. I'm using: OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012

Edit: I also tried to type ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no but still have "Permission denied (publickey)".

So, is there a specific configuration to do in the remote server, for that command to work? Or, when that command will work as expected?

Thanks a lot for advices.

已采纳解答

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

This sounds like a configuration issue on the server side.

If the server allows both public key and password authentication then even if you try to connect without a private key file present on the client, it should prompt you for a password.

If you are getting the error message "Permission denied (publickey)" then it sounds like password authentication is not supported on your server.

Without seeing the /etc/sshd_config file, it is difficult to know but my guess would be that you need to make sure the following line exists:

PasswordAuthentication yes

Restart the ssh server, and when you connect from the client you should be prompted for a password if there is no private key present, or if the private key doesn't match the public key on the server.

A more secure alternative to this of course would be to copy your private key to the laptop which you are using, or in-fact generate a new private key to be used on that laptop and add the public key to .ssh/authorized_keys

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

资料来源与适用范围

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

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

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