Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ubuntu Rundeck-以不同用户身份在本地主机上运行作业_Ubuntu_Rundeck - Fatal编程技术网

Ubuntu Rundeck-以不同用户身份在本地主机上运行作业

Ubuntu Rundeck-以不同用户身份在本地主机上运行作业,ubuntu,rundeck,Ubuntu,Rundeck,我是Rundeck的新手,正在评估它作为Jenkins的替代品来执行我们的临时操作任务 我们在Rundeck服务器上有所有需要作为特定用户运行的命令和脚本,例如:ubuntu 我尝试在一些地方更改配置,如/etc/rundeck/framework.properties(framework.ssh.user=ubuntu)和/var/rundeck/projects/myproject/etc/resources.xml(为localhost节点设置username=“ubuntu”),但我的作

我是Rundeck的新手,正在评估它作为Jenkins的替代品来执行我们的临时操作任务

我们在Rundeck服务器上有所有需要作为特定用户运行的命令和脚本,例如:ubuntu

我尝试在一些地方更改配置,如/etc/rundeck/framework.properties(framework.ssh.user=ubuntu)和/var/rundeck/projects/myproject/etc/resources.xml(为localhost节点设置username=“ubuntu”),但我的作业始终以用户“rundeck”的身份运行,这相当令人沮丧,因为一开始我认为实现这一点应该很简单

所以,我是否遗漏了什么,或者Rundeck无法作为“Rundeck”的不同用户在本地运行脚本

更新: 我现在找到了一个解决方案,那就是使用脚本步骤,然后在advance选项调用字符串中,我可以设置为“sudo-u ubuntu”,这样我的脚本就可以从rundeck以ubuntu的形式运行


然而,使用sudo仍然不是很方便,例如环境变量保存问题

@Arcobaleno您必须调度到rundeck服务器才能使用ssh设置。“本地命令”或未调度的命令步骤使用作为插件点的本地节点执行器。您可以创建一个本地节点执行器来隐式地sudo给您想要的用户,并运行该命令。

您需要使用ssh将本地主机连接到本地主机(将本地主机假装为远程服务器)

i、 e

id\u rsa.pub
复制到
~/.ssh/authorized\u keys
。 (id_ras.pub存储在默认位置
/var/lib/rundeck/.ssh/id_rsa.pub.

然后你可以使用你的ubuntu环境运行你的程序


这对我来说很有用。

你能让脚本在需要的用户中自动运行吗?@Fabio实际上,为了与我们正在使用的其他工具和框架兼容,我们必须以“ubuntu”的形式运行它。我们有很多脚本或命令可能会调用其他工具,这使得他们都需要切换到ubuntu本身,这对我们来说现在不是一个选择。让一个脚本作为ubuntu运行其他脚本怎么样?可以将原始脚本作为第一个参数传递,将其他参数作为以下参数传递。这更现实吗?你能告诉我更具体的情况吗?因为这对我来说是非常新的,我尝试了Command、Script、Local命令,还尝试了在Commands选项卡中的目标节点(localhost)上运行一个命令,似乎没有一个使用我的SSH配置,它们中是否有您提到的本地节点执行器?如果没有,如何创建本地节点执行器?
[ubuntu]$ ssh ubuntu@xx.xx with passwordless ssh.