Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.

like image 515
EGHDK Avatar asked Sep 01 '15 13:09

EGHDK


People also ask

Can I install Jenkins locally?

Run Jenkins on Localhost 8080 Open the web browser and type "localhost:8080". Enter the credentials and log in. If you install Jenkins for the first time, the dashboard will ask you to install the recommended plugins. Install all the recommended plugins.

How do I run Jenkins as local or domain user?

To run Jenkins service using a local or domain user, specify the domain user name and password with which you want to run Jenkins, click on Test Credentials to test your domain credentials and click on Next.

What is the command to install Jenkins as a standalone application?

#1) As A Standalone Application Step 1: After downloading the Java Generic Package, as explained above, launch the command prompt as administrator and type Java –jar jenkins.


1 Answers

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.

like image 120
Dave Bacher Avatar answered Sep 21 '22 13:09

Dave Bacher