file-permissions

Permission denied when installing npm module

ぃ、小莉子 提交于 2019-11-30 06:25:03
问题 I'm getting a strange permission error when I try to install an npm module. I'm starting it with sudo so I'm sure I do have access, but for some reason it keeps complaining with an error: stack Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/joplin/node_modules/sqlite3/build' I've tried restarting my computer, and creating a directory /usr/lib/node_modules/joplin with chmod 777, but it still doesn't work. $ sudo npm install -g joplin /usr/bin/joplin -> /usr/lib/node_modules

How to set rw- r— r— permissions programmatically?

≯℡__Kan透↙ 提交于 2019-11-30 05:41:02
问题 I am developing an application that can restore apps' data back to /data/data/{packageName}. After restoring the files, I am setting the permissions to rw- r-- r--. I set it in this way: public int chmod(File path, int mode) throws Exception { Class fileUtils = Class.forName("android.os.FileUtils"); Method setPermissions = fileUtils.getMethod("setPermissions", String.class, int.class, int.class, int.class); return (Integer) setPermissions.invoke(null, path.getAbsolutePath(), mode, -1, -1); }

how to create a file with world readable permission under subdirectory of files directory

被刻印的时光 ゝ 提交于 2019-11-30 04:52:41
I need to create files under myapp/files/subdir with global permission in my application. I do this because I use external applications to open some files Using this FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_WORLD_READABLE); creates file only under files folder. Using File dir=new File(Constants.TASK_DIRECTORY); dir.mkdirs(); File file=new File(dir, FILENAME); file.createNewFile(); FileOutputStream fos=new FileOutputStream(file); creates files under subdirectories but with private permissions. I need to find a way to compose those both to create a file in a subdirectory to

cmake : How to change file permissions when installing?

孤街浪徒 提交于 2019-11-30 03:35:00
问题 I have a file with 660 flags set, but I want to install it with 700 flags set. How do I do it? How to change the file permission, without changing the permissions of the source file? My install command is this : install( FILES common.sh DESTINATION /rootfs/usr/bin ) and this is what I tried (but it doesn't work) : install( FILES common.sh FILE_PERMISSIONS "600" DESTINATION /rootfs/usr/bin ) 回答1: There is no FILE_PERMISSIONS argument in install(FILES ...). Use PERMISSIONS instead: install(

File permission issue with Mac/Windows when using git

余生长醉 提交于 2019-11-30 03:30:53
问题 I ran the following code to pull files from windows git repository. git pull /Volumes/sucho/Desktop/git/setup And I connect the Windows directory as follows. tell application "Finder" mount volume "cifs://WINDOWS/c$/Users/sucho" as user name "USR" with password "PW" end tell It works well, but the problem is the pulled files from windows have 700 (rwx------). How can I set it 644(rw-r--r--) as default? 回答1: This isn't really answering your original question, but I hope to highlight another

How to make a “Read only” file?

寵の児 提交于 2019-11-30 03:14:12
问题 I'm using the C# StreamWritier class. Questions: How can I make a file read-only, so that no one can delete or write to it? How can I make a hidden file? I'm creating the file like so: private void button1_Click(object sender, EventArgs e) { SaveFileDialog save = new SaveFileDialog(); save.FileName = textBox1.Text; save.Filter = "Text File | *.rtf"; if (save.ShowDialog() == DialogResult.OK) { StreamWriter writer = new StreamWriter(save.OpenFile()); writer.WriteLine(textBox2.Text); } writer

creating symbolic link: Protocol error

陌路散爱 提交于 2019-11-30 01:28:58
I have created linux (Centos) on my virtual box. When I ssh to it and I try to create symbolic link (on my shared folder with full access): ln -s path/folder/example myFolder I get error: ln: creating symbolic link `myFolder': Protocol error Is there any reason or solution to this? It's a problem with the host filesystem. Check the permissions on the host folder are adequate and the the host filesystem supports symlinks. Right click on your command prompt and "Run as Administrator" (or whatever program you're using to make those symlinks needs to be run as adminstrator). Hector GR Here is the

How do I change file permission to a certain file pattern to sub folders of my current directory?

狂风中的少年 提交于 2019-11-29 20:56:31
Using chmod , I do chmod +x *.sh in the current directory but what if I want to change all files including files within subfolders that has an sh file extension?. chmod +x -R * will work but I need something more like chmod +x -R *.sh use find: find . -name "*.sh" -exec chmod +x {} \; Orbling Try using the glorious combination of find with xargs. find . -iname \*.sh -print0 | xargs -r0 chmod +x The . is the directory to start in, in this case the working directory. With modern versions of find , you get the benefits of an xargs approach that avoids multiple calls to the command ( chmod ). The

Possible to give “Network Service” on one computer permission to a directory on another computer?

青春壹個敷衍的年華 提交于 2019-11-29 18:38:38
问题 I have a file: \\Computer1\Share\file.pdf and I need to open in using a service running as the network service account on another computer: Computer2\NETWORK SERVICE FWIW, Both Computer1 and Computer2 are on the same domain Domain1 Is it possible to accomplish this task? 回答1: Yes. If both servers are on the same domain then you can enable access to the share for Domain1\Computer2$ (where Computer2$ represents Network Service on Computer2). 回答2: If it were me, I'd use a domain account to run

PHP File_put_contents not working

白昼怎懂夜的黑 提交于 2019-11-29 18:23:55
Check this code: <?php $url = 'http://www.example.com/downloads/count.txt'; $hit_count = @file_get_contents($url); $hit_count++; @file_put_contents($url, $hit_count); header('Location: wmwc.zip'); ?> @file_get_contents is working fine and the header location change to the downloaded file also works, but either the hit_count increase or @file_put_contents isn't working, because the number with the file doesnt increase by 1. I've set the file permission to 777, but when I try to set the directory permission to 777 also I get a 500 internal server error saying "The server encountered an