是否可以让 jenkins 访问只有 root 或某些特定程序才能访问的文件? [英] Is it possible to allow jenkins to access the files that only root or some specific programs have access to?

查看:24
本文介绍了是否可以让 jenkins 访问只有 root 或某些特定程序才能访问的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我基本上想做的是允许 jenkins 访问我的 android-sdk-linux 文件夹和所有子目录.我的老板不想自己更改文件夹的权限.我应该在构建过程中这样做.我已经看到了一些在构建过程中在执行 shell 中运行一些命令的示例.是否可以在该执行 shell 中运行一些命令,以便 jenkins 可以对我的 android-sdk-linux 文件夹具有读写和执行权限?

What I'm basically trying to do is allow jenkins access my android-sdk-linux folder and all the sub-directories. My boss does not want to change permissions on the folder himself. I am supposed to do it during the build process. I have seen some examples that run some commands in the execute shell during the build process. Is there some commands that can I can run in that execute shell so that jenkins can have read write and execute authority on my android-sdk-linux folder?

推荐答案

正如 bcolfer 所说,您应该能够运行带有sudo"的 shell 命令.您需要确保启动 Jenkins slave 的用户是 sudoer.

As bcolfer said, you should be able to just run your shell commands with "sudo" in front of it. You will want to be sure that the user that started the Jenkins slave is a sudoer.

以 root 身份运行visudo",这将打开/etc/sudoers 文件.如果不是当前的 sudoer,则在底部添加与此类似的行:

As root, run "visudo", this will open the /etc/sudoers file. At the bottom add a line similar to this if it is not a current sudoer:

jenkins        ALL=(ALL)       NOPASSWD: ALL

Jenkins"是启动奴隶的用户.

"Jenkins" being the user that started the slave.

您可以尝试将用户添加到拥有该目录的组中.如果您运行ls -l",您应该能够看到权限,然后是用户,以及拥有该目录的组.知道组后,以 root 身份运行:

You could try adding the user to the group that owns that directory. IF you run "ls -l" you should be able to see the permissions and then the user, and the group that owns the directory. Once you know the group, as root run:

usermod -a -G group Jenkins

Jenkins"是启动slave的用户,group"是实际的组名.

"Jenkins" being the user that started the slave, and "group" being the actual group name.

这篇关于是否可以让 jenkins 访问只有 root 或某些特定程序才能访问的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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