Jenkins从属权限在复制slave.jar时被拒绝 [英] Jenkins Slave Permission Denied while copying slave.jar

查看:1246
本文介绍了Jenkins从属权限在复制slave.jar时被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被拒绝了权限,但不知道为什么.从我的詹金斯大师那里,我能够使用ssh-rsa-key运行以下命令

I get a permissions denied but don't know why. From my jenkins master I was able to run the following command using ssh-rsa-key

scp /var/cache/jenkins/war/WEB-INF/slave.jar jenkins@<my_slave_host>:/var/jenkins/

注意:,当我发现从属主机不存在/var/jenkins/并将其归jenkins用户所有时,我确实在从属主机上手动创建了该文件.我的主jenkins配置为使用.ssh密钥使用jenkins @ mySlaveHost.

Note: I did manually create /var/jenkins/ on the my slave host when i saw it didn't exist and made it owned by the jenkins user. My master jenkins is configured to use the jenkins@mySlaveHost using .ssh keys.

有什么想法为什么我拒绝了我的权限?它想做什么?

Any ideas why I'm getting a permissions denied? What is it trying to do?

这是单击[Lauch slave agent]按钮后来自主詹金斯的日志:

Here's the log from master jenkins after clicking [Lauch slave agent] button:

[02/27/15 15:18:01] [SSH] Opening SSH connection to <my_slave_host>:22.
[02/27/15 15:18:02] [SSH] Authentication successful.
[02/27/15 15:18:03] [SSH] The remote users environment is:
BASH=/bin/bash
BASHOPTS=cmdhist:complete_fullquote:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=()
BASH_ARGV=()
BASH_CMDS=()
BASH_EXECUTION_STRING=set
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="4" [1]="3" [2]="11" [3]="1" [4]="release" [5]="x86_64-pc-linux-gnu")
BASH_VERSION='4.3.11(1)-release'
CATALINA_HOME=/opt/tomcat/current
DIRSTACK=()
EUID=107
GROUPS=()
HOME=/var/lib/jenkins
HOSTNAME=*********** REMOVED***********
HOSTTYPE=x86_64
IFS=$' \t\n'
JAVA_HOME=/usr/lib/jvm/java-7-oracle
LANG=en_US.UTF-8
LOGNAME=jenkins
MACHTYPE=x86_64-pc-linux-gnu
MAIL=/var/mail/jenkins
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
PIPESTATUS=([0]="0")
PPID=10592
PS4='+ '
PWD=/var/lib/jenkins
SHELL=/bin/bash
SHELLOPTS=braceexpand:hashall:interactive-comments
SHLVL=1
SSH_CLIENT='10.57.13.32 34436 22'
SSH_CONNECTION='10.57.13.32 34436 10.57.6.42 22'
TERM=dumb
UID=107
USER=jenkins
XDG_RUNTIME_DIR=/run/user/107
XDG_SESSION_ID=42
_=']'
[02/27/15 15:18:03] [SSH] Checking java version of java
[02/27/15 15:18:04] [SSH] java -version returned 1.7.0_76.
[02/27/15 15:18:04] [SSH] Starting sftp client.
[02/27/15 15:18:04] [SSH] Copying latest slave.jar...
hudson.util.IOException2: Could not copy slave.jar into '/var/jenkins' on slave
    at hudson.plugins.sshslaves.SSHLauncher.copySlaveJar(SSHLauncher.java:1019)
    at hudson.plugins.sshslaves.SSHLauncher.access$300(SSHLauncher.java:133)
    at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:709)
    at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:696)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: hudson.util.IOException2: Could not copy slave.jar to '/var/jenkins/slave.jar' on slave
    at hudson.plugins.sshslaves.SSHLauncher.copySlaveJar(SSHLauncher.java:1016)
    ... 7 more
Caused by: com.trilead.ssh2.SFTPException: Permission denied (SSH_FX_PERMISSION_DENIED: The user does not have sufficient permissions to perform the operation.)
    at com.trilead.ssh2.SFTPv3Client.openFile(SFTPv3Client.java:1201)
    at com.trilead.ssh2.SFTPv3Client.createFile(SFTPv3Client.java:1074)
    at com.trilead.ssh2.SFTPv3Client.createFile(SFTPv3Client.java:1055)
    at hudson.plugins.sshslaves.SFTPClient.writeToFile(SFTPClient.java:93)
    at hudson.plugins.sshslaves.SSHLauncher.copySlaveJar(SSHLauncher.java:1008)
    ... 7 more
[02/27/15 15:18:04] Launch failed - cleaning up connection
[02/27/15 15:18:04] [SSH] Connection closed.

这是从站上的/var/jenkins:

Here's /var/jenkins on the slave:

$ ls -al
total 436
drwxr-xr-x  2 jenkins jenkins     22 Feb 27 15:17 .
drwxr-xr-x 14 root    root      4096 Feb 27 15:12 ..
-rw-r--r--  1 jenkins jenkins 439584 Feb 27 15:17 slave.jar

至于SFTP,我认为它没有启用,您能指出任何文档说SFTP是从属服务器的先决条件吗?我看过的所有页面都没有提到SFTP.

As for SFTP, I do not think it is enabled, can you point me to any docs that says SFTP is a pre-requisite for a slave? All the pages I've seen do not mention SFTP.

推荐答案

问题似乎与您的远程根目录设置有关.这必须是slave.jar的位置,因为Jenkins会尝试从那里执行它.

It looks like the problem is tied to your Remote root directory setting. That needs to be the location of the slave.jar, as Jenkins will try to execute it from there.

关于权限,需要配置远程根目录(无论您将其设置为什么),以允许Jenkins访问它.

As for the permissions, the Remote Root Directory (whatever you set it to) needs to be configured to allow Jenkins to access it.

因此,如果您将远程"根目录设置更改为/var/jenkins/,则应该成功启动Jenkins从属服务器.

Therefore, if you change your Remote root directory setting to be /var/jenkins/ in your case, it should launch the Jenkins slave successfully.

这篇关于Jenkins从属权限在复制slave.jar时被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆