是否可以允许jenkins访问仅root用户或某些特定程序可以访问的文件? [英] Is it possible to allow jenkins to access the files that only root or some specific programs have access to?

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

问题描述

我基本上想做的是允许jenkins访问我的android-sdk-linux文件夹和所有子目录.我的老板不想自己更改文件夹的权限.我应该在构建过程中这样做.我已经看到了一些在构建过程中在execute 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所说的那样,您应该能够在shell命令前加上"sudo".您将要确保启动Jenkins奴隶的用户是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.

OR

您可以尝试将用户添加到拥有该目录的组中.如果运行"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"是启动从属的用户,"group"是实际的组名.

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

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

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