jenkins:发布时出现异常,异常消息[权限被拒绝]

时间:2018-10-26 12:00:52

标签: jenkins

当我使用插件'publish over ssh'构建项目时,jenkins向我显示错误:

[INFO] Packaging webapp
[INFO] Assembling webapp [bc-ctq] in [/var/lib/jenkins/workspace/bc- 
ctq/target/bc-ctq]
[INFO] Processing war project    
[INFO] Copying webapp resources [/var/lib/jenkins/workspace/bc-        ctq/src/main/webapp]
[INFO] Webapp assembled in [140 msecs]
[INFO] Building war: /var/lib/jenkins/workspace/bc-ctq/target/bc-ctq.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.018 s
[INFO] Finished at: 2018-10-26T19:38:10+08:00
[INFO] ------------------------------------------------------------------------
SSH: Connecting from host [localhost.localdomain]
SSH: Connecting with configuration [love] ...
SSH: Disconnecting configuration [love] ...
ERROR: Exception when publishing, exception message [Permission denied]
Archiving artifacts
Finished: UNSTABLE

Send files or execute commands over SSH after the build runs

the ssh server config

2 个答案:

答案 0 :(得分:0)

我遇到了类似的错误,事实证明这是所有权问题。您的项目文件夹的所有者应与Jenkins用于将SSH远程传输到您的实例中的所有者相同。

通过在父目录中运行ls -ltr来检查文件夹的所有权。

使用sudo chown -R owner:group DirectoryName/

更改所有权

答案 1 :(得分:0)

检查详细输出并开始构建,然后您将看到问题所在

screenshot