问题描述
我安装了jenkins,我试图进入一个shell作为Jenkins添加一个ssh键。我似乎不能su到jenkins用户:
I've installed jenkins and I'm trying to get into a shell as Jenkins to add an ssh key. I can't seem to su into the jenkins user:
[root@pacmandev /]# sudo su jenkins
[root@pacmandev /]# whoami
root
[root@pacmandev /]# echo $USER
root
[root@pacmandev /]#
jenkins用户存在于我的/ etc / passwd文件中。 Runnin su jenkins
要求输入密码,但拒绝我的正常密码。 sudo su jenkins
似乎没有做任何事情;相同的 sudo su - jenkins
。我在CentOS。
The jenkins user exists in my /etc/passwd file. Runnin su jenkins
asks for a password, but rejects my normal password. sudo su jenkins
doesn't seem to do anything; same for sudo su - jenkins
. I'm on CentOS.
推荐答案
jenkins是一个服务帐户,它没有shell设计。一般认为服务帐户不能以交互方式登录。
jenkins is a service account, it doesn't have a shell by design. It is generally accepted that service accounts shouldn't be able to log in interactively.
我最初没有回答这个帐户,因为它是一个。
I didn't answer this one initially as it's a duplicate of a question that has been moved to server fault. I should have answered rather than linked to the answer in a comment.
如果由于某种原因要以jenkins登录,可以这样做:
sudo su -s / bin / bash jenkins
if for some reason you want to login as jenkins, you can do so with:sudo su -s /bin/bash jenkins
这篇关于在安装Jenkins后无法su到用户jenkins的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!