1

I am trying, and failing, to give the user jenkins write access to /root.

Firstly: Yes, this is not something you would normally recommend doing. But for some reason Jenkins is insisting on writing and reading from the roots home directory. If you know immediately why it is doing that and how to stop, I will gladly look at it. But for now, as much as it goes against my better judgement, I need to give jenkins write permissions to /root.

On a safety note, there is nothing in /root that I have not put there myself.

This is what I am running (initially logged in as root):

~# chmod o=rwx /root
~# sudo su jenkins
/root$ touch test
touch: cannot touch 'test': Permission denied
/root$ cd .pip/
/root/.pip$ touch test
/root/.pip$ ls
pip.conf  pip.log  test

So this is the weird thing.

I have already given read/write permissions to the subfolders within /root which works fine. But I still cannot actually write to the directory itself.

Does anyone have any idea why?

  • 1
    Do you really mean /root ? The root directory is / – Carl H May 19 '16 at 13:08
  • 2
    Is there a pre-existing (root owned) file called test in /root? Regardless, I think you should start a separate Q about your apparent jenkins configuration problem. – steeldriver May 19 '16 at 13:15
  • @CarlH I really mean /root. thankfully I don't have to give permissions to / – Scironic May 19 '16 at 13:17
  • @steeldriver just did a sanity check and no, there is no file already called test in the directory. – Scironic May 19 '16 at 13:17
  • 1
    Try chmod -R o=rwx /root – UniversallyUniqueID May 19 '16 at 14:21
1

An alternative to giving everyone write access to the /root directory is to use acls to give the jenkins user access to the /root directory.

~# setfacl -m "u:jenkins:rwx" /root

Most Ubuntu installs already have Access Control Lists enabled, but you might have to first install the acl package. Additionally, you can and the R flag to make the action recursive.

| improve this answer | |
  • Thanks for the answer. I tried it out and no change. As well as with the recursive flag. – Scironic May 20 '16 at 7:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.