安装 Jenkins 后无法向用户 jenkins [英] Can't su to user jenkins after installing Jenkins

查看:34
本文介绍了安装 Jenkins 后无法向用户 jenkins的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了 jenkins 并且我正在尝试以 Jenkins 的身份进入 shell 添加一个 ssh 密钥.我似乎无法进入 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 是一个服务帐户,它在设计上没有外壳.普遍接受的是,服务帐户不应该能够以交互方式登录.

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 后无法向用户 jenkins的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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