TransWikia.com

Jenkins home directory issue /home/jenkins/.ssh

Super User Asked by Rodrigo Montano on December 21, 2021

I’m using the GitLab plugin for jenkins to clone a repository, the issue is that ‘jenkins’ is a system account with no home directory (the env variable is poinint to JENKINS_HOME=”/var/lib/jenkins”)

And if I try to clone a protected repository I get the error

stdout: 
stderr: Could not create directory '/home/jenkins/.ssh'.
Host key verification failed.
fatal: Could not read from remote repository.

I tried to move the home directory with usermod but since is not a conventional user account it fails

usermod: user 'jenkins' does not exist in /etc/passwd

And since my home directories are under a NFS I cannot create a symlink between /home/jenkins and /var/lib/jenkins

How can I move/point the system account home directory to /var/lib/jenkins instead of /home/jenkins?

Thanks

One Answer

You should be able to change it with usermod:

-d, --home HOME_DIR

The user's new login directory.

If the -m option is given, the contents of the current home directory will be moved to the new home directory, which is created if it does not already exist.

So you just need to

usermod -d /var/lib/jenkins jenkins

on the system where the account is defined.

Answered by Toby Speight on December 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP