24

Specifically, I am trying test something on my build server by switching to the "jenkins" user:

sudo su - jenkins
No passwd entry for user 'jenkins'
kevlarjacket
  • 407
  • 1
  • 4
  • 12

2 Answers2

17

The error message is pretty much self-explanatory. It says that the user jenkins has no entry in the /etc/passwd file i.e. the user does not exist in the system.

When you do any user related operations that requires username, password, home directory, shell information, the /etc/passwd file is consulted first. No entry in that file leading to the very error you are getting. So you need to create the user first (useradd/adduser). As a side note, unless necessary you should create any service specific user (non-human) e.g. jenkins as system user.

heemayl
  • 54,820
  • 8
  • 124
  • 141
  • 23
    I would argue that it is not self-explanatory. The error is about a password and the problem is the non existence of a user. If the error was the user does not exist that would be self-explanatory. – YannickSSE Jun 06 '18 at 17:36
  • 1
    @YannickSSE the error message is not about password, it is about *passwd* which is the traditional database of user accounts on a system (residing in `/etc/passwd`). On most modern systems, the passwords as such are stored elsewhere - often in `/etc/shadow`. – peterph Dec 29 '18 at 21:58
  • You can force it with `su -s /bin/bash jenkins` – themadmax Jul 11 '23 at 07:04
4

After a quick search for "List all users in Linux", I found this answer and ran the following command:

cut -d: -f1 /etc/passwd

and, As @Ipor Sircer, suggested, this user does not actually exist, and I have to add it with:

adduser jenkins
kevlarjacket
  • 407
  • 1
  • 4
  • 12
  • Did it resolved your issue? Does creating a `jenkins` user by yourself is same as the user created by jenkins itself? – reiley Oct 28 '18 at 15:49