EACCES error using spawnSync with CUPS command-line

I'm heaving problems with permission on running this CUPS command : cancel -a where -a is the option to cancel all jobs on all printers.

this is my spawnSync function:

cancelAll = function () {
  let args = ["-a"];
  let cancelAll = spawnSync("cancel", args, { encoding: "utf-8", shell: '/home/finsoft'});
 // console.log(cancelAll);
  return cancelAll;

the option shell:'/home/finsoft' is the path to the shell I want to use.

what I did until now:

1)I tried adding to the root group the user used in the spawnSync, which is finsoft, and i double checked it by running this:

 let args = ["-u"];
// let uid = spawnSync('id', args, { encoding: "utf-8"});

output of the console.log(uid):

  status: 0,
  signal: null,
  output: [ null, '1000\n', '' ],
  pid: 8141,
  stdout: '1000\n',
  stderr: ''

the witch correspond to the finsoft uid

2)i changed the permissions of /home/finsoft like this:

sudo chmod 777 /home/finsoft

the result of ls-l:

finsoft@finsoft-20351:/home$ ls -l
total 4
drwxrwxrwx 34 finsoft finsoft 4096 Feb 23 09:11 finsoft
  1. I even tried to specify the option uid:0 in the spawnSync, it should use the root user, and changed the shell path to its default(/bin/sh), so i shouldn't have problems with permissions or other requirements stuff, but that gives a totally different error:

Error: spawnSync /bin/sh EPERM

What else can I try?

Read more here: https://stackoverflow.com/questions/66332524/eacces-error-using-spawnsync-with-cups-command-line

Content Attribution

This content was originally published by Gabriele Battistata at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: