Meysam
Meysam

Reputation: 18117

How to grant jenkins user permission to access a specific directory on linux

I need to grant jenkins user permission to access some specific directories like usr/lib or usr/local/include so that he can copy some files into those directories during the execution of some Jenkins jobs. How can I do that?

Upvotes: 0

Views: 4609

Answers (3)

Igor Maximov
Igor Maximov

Reputation: 596

You mentioned usr/lib or usr/local/include directories, and if your goal is to install some tools and packages during job execution, you could install it locally into your job workspace (for example, into .local directory) and after that make your jobs work with those directories by setting environment variables like LD_LIBRARY_PATH, CFLAGS, etc.

Upvotes: 0

Satish
Satish

Reputation: 17397

For specific task i would say use sudo

Upvotes: 0

jwernerny
jwernerny

Reputation: 7048

The idea that something accessed from the web can overwrite system files is very scary (and insecure), but I think you would need to grant the user under which Jenkins is running the privileges need to write there.

Again, there are good reasons why ordinary user's aren't granted permissions to write to those directories. You might want to consider running the job in a chroot jail. That way, if something goes wrong, you won't destroy your system.

Upvotes: 1

Related Questions