EGHDK
EGHDK

Reputation: 18130

Installing Jenkins on a local server, I already have a user named "jenkins"

I'm installing jenkins on a local server to be accessed locally within my network. I see this line in the docs for jenkins:

The 'jenkins' user is created to run this service. If you change this to a different user via the config file, you must change the owner of /var/log/jenkins, /var/lib/jenkins, and /var/cache/jenkins.

I already created a jenkins user on the centos server before installing jenkins. Jenkins runs and seems to work just fine. I'm curious whether creating a user with the same name will present any issues in the future.

Upvotes: 9

Views: 1689

Answers (2)

Dave Bacher
Dave Bacher

Reputation: 15972

TL;DR Jenkins will use the user you created, but you may want to double check some settings for consistency.

The preinstall script (see below) in the Jenkins package will try to create the jenkins user and jenkins group, but if either step fails because the user or group exists, it's not an error -- a common case when this occurs is when the user account remains from a previous Jenkins installation. Jenkins will run using the existing user and permissions on the Jenkins directories will be set correctly.

/usr/sbin/groupadd -r jenkins &>/dev/null || :
# SUSE version had -o here, but in Fedora -o isn't allowed without -u
/usr/sbin/useradd -g jenkins -s /bin/false -r -c "Jenkins Continuous Integration Server" \
        -d "/var/lib/jenkins" jenkins &>/dev/null || :

Assuming this is what you want, everything is fine. There are a couple things you might want to check:

  • Jenkins creates a system user without login permissions (the shell is /bin/false). This means that the jenkins user will be able to run processes and own files and directories, but will not be able to log in through ssh or the console. This is a security setting that reduces the possible vectors of intrusion. Depending on your plans for your jenkins user, you may want to similarly disable logins.
  • The jenkins user's primary group is jenkins.
  • The jenkins user's home directory is set to /var/lib/jenkins.

The last two are primarily for convenience -- e.g. it may be useful to have other users who can read Jenkins log files (be belonging to the associated group). I can't think of things that would go wrong if these aren't set as in the preinstall script, but it seems like a good idea to be consistent.

These user account settings are stored in /etc/passwd. On Debian/Ubuntu distributions, user account settings can be modified with usermod.

Upvotes: 5

DevD
DevD

Reputation: 664

if the user "jenkins" already exists, it wont cause any issues unless if you would have revoked permission to do certain operations like accessing config directories,ssh authentication,mount,etc..

I have used a existing user and it never caused any consistency or performance issue.

Upvotes: 0

Related Questions