1

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 all the output in console:

error: Error: spawnSync /home/finsoft EACCES
      at Object.spawnSync (internal/child_process.js:1041:20)
      at spawnSync (child_process.js:616:24)
      at Object.cancelAll (/home/finsoft/ProgettoStampantiLinux/ProgettoStampanti/api/cupsApis.js:155:19)
      at /home/finsoft/ProgettoStampantiLinux/ProgettoStampanti/app.js:80:24
      at Layer.handle [as handle_request] (/home/finsoft/ProgettoStampantiLinux/ProgettoStampanti/node_modules/express/lib/router/layer.js:95:5)
      at next (/home/finsoft/ProgettoStampantiLinux/ProgettoStampanti/node_modules/express/lib/router/route.js:137:13)
      at Route.dispatch (/home/finsoft/ProgettoStampantiLinux/ProgettoStampanti/node_modules/express/lib/router/route.js:112:3)
      at Layer.handle [as handle_request] (/home/finsoft/ProgettoStampantiLinux/ProgettoStampanti/node_modules/express/lib/router/layer.js:95:5)
      at /home/finsoft/ProgettoStampantiLinux/ProgettoStampanti/node_modules/express/lib/router/index.js:281:22
      at Function.process_params (/home/finsoft/ProgettoStampantiLinux/ProgettoStampanti/node_modules/express/lib/router/index.js:335:12) {
    errno: 'EACCES',
    code: 'EACCES',
    syscall: 'spawnSync /home/finsoft',
    path: '/home/finsoft',
    spawnargs: [ '-c', 'cancel -u' ]
  },
  status: null,
  signal: null,
  output: null,
  pid: 9826,
  stdout: null,
  stderr: null
}

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"];
  args.push('finsoft');
  let uid = spawnSync('id', args, { encoding: "utf-8"});
console.log(uid);

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?

0 Answers0