Changing Jenkins' Runtime User on Ubuntu

If you need to change the user and user group of jenkins runtime

Need to change the user and user group in the jenkins daemon configuration

For example, if you install jenkins with apt-get under Ubuntu, the default user is the jenkins user and user group. Use systemctl to manage the daemon process. The corresponding configuration file is: /usr/lib/systemd/system/jenkins.service

If you modify the user and user group in the configuration file, you must also modify the owner and owning group of the jenkins home directory.

chown -R www:www /var/lib/jenkins/cache

And the corresponding running cache directory permissions

/var/cache/

In this way, reload the configuration through systemctl daemon-reload, and then systemctl start jenkins.