我的权限被拒绝,但不知道为什么。从我的詹金斯大师那里,我能够使用ssh-rsa-key运行以下命令
scp /var/cache/jenkins/war/WEB-INF/slave.jar jenkins@<my_slave_host>:/var/jenkins/
注意: 当我发现从属主机不存在并使其由jenkins用户拥有时,我确实在从属主机上手动创建了/ var / jenkins /。我的主jenkins配置为使用.ssh密钥使用jenkins @ mySlaveHost。
有什么想法为什么我会拒绝权限吗?它想做什么?
这是单击[Lauch slave agent]按钮后来自主詹金斯的日志:
[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:
$ 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。
看来问题与您的远程根目录设置有关。这需要是slave.jar的位置,因为Jenkins会尝试从那里执行它。
至于权限,需要配置远程根目录(无论您将其设置为什么),以允许Jenkins访问它。
因此,如果您将远程根目录设置更改为/ var / jenkins /,则应该成功启动Jenkins从属。