java.io.IOException: Password authentication failed

本文详细介绍了如何在OpenSUSE 11.1系统中解决SSH服务被禁用导致Java无法调用远程Shell脚本的故障。通过修改sshd_config文件,调整配置项,重新启动SSH服务,最终成功解决问题。

最近在项目中要用到java调用远程shell脚本,从网上下载了ssh2,去执行方法的时候,出现了如下错误:
java.io.IOException: Password authentication failed.
at ch.ethz.ssh2.auth.AuthenticationManager.authenticatePassword(AuthenticationManager.java:300)
at ch.ethz.ssh2.Connection.authenticateWithPassword(Connection.java:309)
at test.demo.TestSSH.main(TestSSH.java:19)
Caused by: java.io.IOException: Authentication method password not supported by the server at this stage.
at ch.ethz.ssh2.auth.AuthenticationManager.authenticatePassword(AuthenticationManager.java:270)
... 2 more
错误原因是:linux服务器中的ssh服务被禁用了,所以我们只需要将Linux下的ssh服务开启即可,下面介绍如何开启ssh服务

介绍OpenSUSE 11.1中如何开启ssh服务
详细内容
打开系统菜单中的super命令控制台,

类似windows下的cmd窗口,

照以下步骤输入命令并操作:

1、修改sshd_config文件,命令为:vi /etc/ssh/sshd_config

2、将#PasswordAuthentication no的注释去掉,并且将NO修改为YES

3、将#PermitRootLogin yes的注释去掉

4、重新启动SSH服务,命令为:/etc/init.d/sshd restart

5、验证SSH服务状态,命令为:/etc/init.d/sshd status

dbeaver转储数据库报错D:\mysql\mysql-8.0.12-winx64\mysql-8.0.12-winx64\bin\mysqldump.exe --skip-lock-tables --routines --add-drop-table --disable-keys --extended-insert -u root --host= ais_flow 任务 'MySQL 转储' 开始于 Fri Nov 28 10:42:52 CST 2025 mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect 任务 'MySQL 转储' 结束于 Fri Nov 28 10:42:52 CST 2025 2025-11-28 10:42:52.932 - IO error: Process failed (exit code = 2). See error log. 2025-11-28 10:42:52.932 - java.io.IOException: Process failed (exit code = 2). See error log. at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.validateErrorCode(AbstractNativeToolHandler.java:263) at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.executeProcess(AbstractNativeToolHandler.java:241) at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.doExecute(AbstractNativeToolHandler.java:283) at org.jkiss.dbeaver.ext.mysql.tasks.MySQLNativeToolHandler.doExecute(MySQLNativeToolHandler.java:47) at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.lambda$0(AbstractNativeToolHandler.java:87) at org.jkiss.dbeaver.runtime.RunnableContextDelegate.lambda$0(RunnableContextDelegate.java:39) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:124) C:\Users\Administrator\AppData\Roaming\DBeaverData\drivers\clients\mysql_8\win\mysqldump.exe --skip-lock-tables --routines --add-drop-table --disable-keys --extended-insert -u root --host= ais_flow 任务 'MySQL 转储' 开始于 Fri Nov 28 10:43:16 CST 2025 mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect 任务 'MySQL 转储' 结束于 Fri Nov 28 10:43:17 CST 2025 2025-11-28 10:43:17.162 - IO error: Process failed (exit code = 2). See error log. 2025-11-28 10:43:17.162 - java.io.IOException: Process failed (exit code = 2). See error log. at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.validateErrorCode(AbstractNativeToolHandler.java:263) at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.executeProcess(AbstractNativeToolHandler.java:241) at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.doExecute(AbstractNativeToolHandler.java:283) at org.jkiss.dbeaver.ext.mysql.tasks.MySQLNativeToolHandler.doExecute(MySQLNativeToolHandler.java:47) at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.lambda$0(AbstractNativeToolHandler.java:87) at org.jkiss.dbeaver.runtime.RunnableContextDelegate.lambda$0(RunnableContextDelegate.java:39) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:124)
最新发布
11-29
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值