Crane Singh
Crane Singh

Reputation: 1

Copying files from one directory to another directory in jenkins master machine

I am trying to copying files from one directory to another directory in Jenkins master machine facing access denied issue while executing in the shell script

cp -a /usr/lib/hook/pm2-logs/. /usr/lib/hook/Hook_Log_Backup/

Issue:

cp: cannot create regular file '/usr/lib/hook/Hook_Log_Backup/./pr_hook_out-0.log': Permission denied cp: cannot create regular file '/usr/lib/hook/Hook_Log_Backup/./pr_hook_err-0.log': Permission denied cp: cannot create regular file '/usr/lib/hook/Hook_Log_Backup/./system_hook_out-1.log': Permission denied cp: cannot create regular file '/usr/lib/hook/Hook_Log_Backup/./system_hook_err-1.log': Permission denied cp: cannot create regular file '/usr/lib/hook/Hook_Log_Backup/./common_hook_out-2.log': Permission denied

Upvotes: 0

Views: 362

Answers (1)

Pankaj Saini
Pankaj Saini

Reputation: 1648

You are trying to write to your machine path (/usr/lib/); It means your user running Jenkins does not have write access to that directory (or it's parent directory). If the user running Jenkins has access to do sudo on the machine; you can try it with 'sudo cp'

Upvotes: 0

Related Questions