'Jenkins custom workspace Access denied expection

I created a simple pipeline to execute a custom script. I strongly need to run this script inside a specific folder, but I continuely obtain Access Denied exception.

Scenario:

CRON_SETTINGS = '''H H * * *'''
    
pipeline {
    agent{ 
        node{ 
            label ''
            customWorkspace  '/home/workspace/generator/'
        } 
    }
    triggers {
        cron(CRON_SETTINGS)
    }
    stages {
        stage('Create documents'){
            steps{
                script{
                    sh '''#!/bin/bash 
                    pwd'''
                }
                
            }
        }
    }
}

I made Jenkins the owner of the folder generador with all the rights. Even so, I obtain the following error:

[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/workspace/Generator
[Pipeline] {
[Pipeline] ws
Running in /home/workspace/generator
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Create documents)
[Pipeline] script
[Pipeline] {
[Pipeline] sh
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // ws
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.nio.file.AccessDeniedException: /home/workspace/generator@tmp

My script do not creates a temporal folder, why does Jenkins do that and how can I solve it?

Thanks in advance!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source