set file permissions and ownership after writeFileSync() in JS

I have the following function which creates the file and then sets custom permissions and ownership inherited from the parent directory. I run into the problem when building the chown command. The expected command is chown yury.stanev:yury.stanev /home/yury.stanev/menlolab/runner/config.json as one line, but for some reason the path never gets appended to the command and I get chown: missing operand after ‘yury.stanev:yury.stanev’ I’ve tried a few different ways to build it such as shelljs.exec(`sudo chown $ {owner}:$ {group} $ {process.env.CONFIG_FILE}`); alas it doesn’t work. Where am I going wrong?

  exports.save = () => {   if (!process.env.NOCONFIGSAVE) {     fs.writeFileSync(       process.env.CONFIG_FILE,       JSON.stringify(exports, 2),       'utf8',     );      // * Set config file permissions to: -rw-rw---- ... /etc/menlolab-runner/config.json      const ownerGroup = shelljs.exec('ls -la ../ | grep -e "`basename $  (pwd)`$  "  | awk \'{print $  3, $  4}\'').split(' ');     if (!ownerGroup) {       throw new Error("Couldn't get owner");     }      console.log('HERE ->', process.env.CONFIG_FILE);     const owner = ownerGroup[0];     const group = ownerGroup[1];     let cmd = `sudo chown $  {owner}:$  {group} `;     cmd += process.env.CONFIG_FILE;     console.log('COMMAND -> ', cmd);     // fs.chown(process.env.CONFIG_FILE, owner, group)     shelljs.exec(cmd);     shelljs.exec(`sudo chmod 660 $  {process.env.CONFIG_FILE}`); // TODO Switch .json to .yml after MR # 13 is accepted     console.log('Config file saved!');   } else {     console.log('Skipping Save');   } }; 

Output

Config File Location:  /home/yury.stanev/menlolab/runner/config.json Job Working Directory:  /tmp Config file not found! /home/yury.stanev/menlolab/runner/config.json No Config found. Requesting new Runner ID ? Enter the runner api address http://loca yury.stanev yury.stanev HERE -> /home/yury.stanev/menlolab/runner/config.json COMMAND ->  sudo chown yury.stanev:yury.stanev  /home/yury.stanev/menlolab/runner/config.json chown: missing operand after ‘yury.stanev:yury.stanev’ Try 'chown --help' for more information. /bin/sh: 2: /home/yury.stanev/menlolab/runner/config.json: Permission denied Config file saved! 

Ownership issue (homer software)

I am trying to install homer software and every time its not completing, the folder is inside my home directory and i started with sudo then to i am unable to install, can any 1 help me to resolve this issue. (below is the massage)

2019-06-30 18:06:43 (755 KB/s) - ‘homer.package.zip’ saved [1482491107/1482491107]          Unzipping...         Finished Installing hg19  Trouble opening /home/krunal/Krunal/Software/.//bin/findMotifs.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/findMotifs.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/findMotifs.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/findMotifsGenome.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/findMotifsGenome.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/findMotifsGenome.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/compareMotifs.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/compareMotifs.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/compareMotifs.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/findKnownMotifs.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/findKnownMotifs.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/findKnownMotifs.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/convertIDs.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/convertIDs.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/convertIDs.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/findGOtxt.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/findGOtxt.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/findGOtxt.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/findGO.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/findGO.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/findGO.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/annotatePeaks.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/annotatePeaks.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/annotatePeaks.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/makeBigWig.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/makeBigWig.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/makeBigWig.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/makeMultiWigHub.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/makeMultiWigHub.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/makeMultiWigHub.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/annotateInteractions.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/annotateInteractions.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/annotateInteractions.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/getConservedRegions.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/getConservedRegions.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/getConservedRegions.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/getDistalPeaks.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/getDistalPeaks.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/getDistalPeaks.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/annotateTranscripts.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/annotateTranscripts.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/annotateTranscripts.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/checkTagBias.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/checkTagBias.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/checkTagBias.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/getGWASoverlap.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/getGWASoverlap.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/getGWASoverlap.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/loadPromoters.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/loadPromoters.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/loadPromoters.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/loadGenome.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/loadGenome.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/loadGenome.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/HomerConfig.pm readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/HomerConfig.pm': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/HomerConfig.pm': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/scanMotifGenomeWide.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/scanMotifGenomeWide.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/scanMotifGenomeWide.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/analyzeChIP-Seq.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/analyzeChIP-Seq.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/analyzeChIP-Seq.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/preparseGenome.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/preparseGenome.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/preparseGenome.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/GenomeOntology.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/GenomeOntology.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/GenomeOntology.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/analyzeRNA.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/analyzeRNA.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/analyzeRNA.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/analyzeRepeats.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/analyzeRepeats.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/analyzeRepeats.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/removeOutOfBoundsReads.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/removeOutOfBoundsReads.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/removeOutOfBoundsReads.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/addGeneAnnotation.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/addGeneAnnotation.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/addGeneAnnotation.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/prepForR.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/prepForR.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/prepForR.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/assignTSStoGene.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/assignTSStoGene.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/assignTSStoGene.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/findHiCInteractionsByChr.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/findHiCInteractionsByChr.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/findHiCInteractionsByChr.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/getHiCcorrDiff.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/getHiCcorrDiff.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/getHiCcorrDiff.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/runHiCpca.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/runHiCpca.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/runHiCpca.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/findHiCDomains.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/findHiCDomains.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/findHiCDomains.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/SIMA.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/SIMA.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/SIMA.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/convertOrganismID.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/convertOrganismID.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/convertOrganismID.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/makeMetaGeneProfile.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/makeMetaGeneProfile.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/makeMetaGeneProfile.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/getDifferentialPeaksReplicates.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/getDifferentialPeaksReplicates.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/getDifferentialPeaksReplicates.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/filterTADsAndLoops.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/filterTADsAndLoops.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/filterTADsAndLoops.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/findTADsAndLoops.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/findTADsAndLoops.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/findTADsAndLoops.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/findcsRNATSS.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/findcsRNATSS.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/findcsRNATSS.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/../update/updateUCSCGenomeAnnotations.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/../update/updateUCSCGenomeAnnotations.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/../update/updateUCSCGenomeAnnotations.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/../update/updateGeneIdentifiers.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/../update/updateGeneIdentifiers.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/../update/updateGeneIdentifiers.pl': No such file or directory Trouble opening /home/krunal/Krunal/Software/.//bin/../update/updatePromoters.pl readline() on closed filehandle IN at configureHomer.pl line 836. mv: cannot move '.new.pl' to '/home/krunal/Krunal/Software/.//bin/../update/updatePromoters.pl': No such file or directory chmod: cannot access '/home/krunal/Krunal/Software/.//bin/../update/updatePromoters.pl': No such file or directory readline() on closed filehandle IN at configureHomer.pl line 864. mv: cannot move '.new.cpp' to '/home/krunal/Krunal/Software/.//cpp/SeqTag.cpp': No such file or directory make: *** /home/krunal/Krunal/Software/.//cpp/: No such file or directory.  Stop. make: *** /home/krunal/Krunal/Software/.//cpp/: No such file or directory.  Stop. 

What file ownership and permissions should I initially set for the files/dirs before open sourcing a project?

I have multiple projects in different languages that I will upload on Gitlab/hub etc as Open Source projects. What file permissions and ownerships should I set on the files before uploading them? I work on Linux-platforms. It feels wrong uploading files with permission MYNAME:MYNAME as owner and group. Of course, anyone can change the permissions and ownership to their liking after downloading the project (or maybe they are on other platforms) but is there a best-practice on what to set owner, user and group to initially?

take ownership of orphan project on github [on hold]

About a decade ago, I wrote a file of emacs lisp and put it on emacswiki and forgot about it. I found recently that it has been put on GitHub. Nobody is doing anything with it as far as I can tell. At present, I know next to nothing about git but I would like to take over this file on GitHub and develop it properly. What do I need to do?

Android app: How to prove app ownership?

To explain my question I will give an example:

Lets say I finished developing my android app and I am ready to publish on google play. Now lets say my app uses in app purchases, so users can pay and google sends my share of the money to my bank account through wire transfer. There will come a time when the bank in my country will ask me why google is sending money to your bank account, If I told them that they are sending money because I have an app on google play store, they might ask me to prove that I own that app.

So the question is:

How do I prove to someone (example: the bank) that I own a specific app?

Is the app a thing that needs licensing and papers?

Thanks all.

what is the correct ownership for files in /Applications

It has been a while since last using Fritzing, and I was trying to open one of the files I saved almost 2 years ago.

The iMac was purchased early 2018, and everything copied from my MacBook

I have updated my iMac to the latest Mojave release, and got strange errors.

enter image description here

I looked at /Applications/Fritzing.app to see what I could change and found it was owned by my daughter (who has a login on my computer)

I used chown to change this, but a few other apps were also owned by her.

I seem to have a collection of root, ian (me) and bec (even one owned by my wife). Neither of these would have installed any apps on my computer, so I don’t know why.

My question is what is the correct ownership for files in /Applications

Can someone please help me transfer Facebook business page ownership?

I am trying to transfer a business page ownership to one of the admin’s on the page. I can no longer be the owner. It seems impossible to do. Can anyone help me? Or tell me how I can get in contact with Facebook? It seems crazy they promote Facebook advertising so much but there is no tech support team.