chmod

git 修改文件权限

泪湿孤枕 提交于 2019-12-15 14:36:48
git 修改文件权限 问题分析 Windows 下的文件是否可执行是由扩展名决定的,但是linux下是否可执行是文件的可执行属性决定的。 有时候windows 下开发写的脚本程序,提交的git 仓库中时就有可执行权限,以便在linux和macOS上克隆下来就能直接执行。 如果在linux下就先添加可执行权限后commit和push,如果在windows下就需要通过git命令修改了。 解决方法: 1. 查看文件权限 $ git ls-tree HEAD 100644 blob d116ef8f223343c3425ff48c83e82fee60ff7e31 .gitignore 100644 blob 5627c82972a898248d36da3933bc4195865d7014 README.en.md 100644 blob 828b1b40d264cdbd9dea4f5178e14de0559e0d3e README.md 040000 tree a6db25934db55524d03f67f5901cc74308974ba6 g 100644 blob 06d39d8eacc78062af472cbfa40e819c9308d769 go.mod 100644 blob 25feac03517d5e29ca46d53d032ac0edffe447b9 go.sum

keywords : stat access chmod chown chgrp bit mask umask

十年热恋 提交于 2019-12-15 04:34:36
stat 可以是一个函数进行使用,也是一个linux内核中的一个api man 2 stat里面就展示了它的描述 These functions return information about a file, in the buffer pointed to by statbuf. stat 就是用来 返回文件的各种信息的 在terminal里面直接stat + 文件的话就显示了文件的各种信息,会看到有access, 接着说access,access的话也有几个mode位,F_OK、R_OK、W_OK、X_OK,返回值0是可以,-1是不行。 然后基本的话可以自己通过man手册看这些api的原型然后在程序里面自己实现一次,大概就懂了。 chmod 就是用来改这个文件的权限的,分属主 组 其他这三个 学习的时候主要是没看懂chmod里面的bit mask 后来慢慢的懂了,竖着来看分三组,4转换成2进制就是100、2的话就是010、1的话就是1,这不就是对应了之前将的mode未到rwx对应421咩,这样看就懂了。 chown是改变文件的属主权限的,比如之前在czp这个属主的,现在可以chown root 1.txt 这样 至于chgrp也是一样的理解 最后讲了一下umask 在terminal里面直接umask可以查看当前的umask是多少,当然也可以umask 0044这样去设置

Linux -- chmod 命令,权限等概念简单了解

喜夏-厌秋 提交于 2019-12-14 22:25:23
Linux系统中的每个文件和目录都有访问许可权限,文件或目录的访问权限包括读,写和可执行三种。 - rwxrwxrwx 这里显示的权限是依次排列的,分别为: [ 用户 ] [ 同组 ] [ 其他 ] 用户权限,就是你自己的权限。英文:user,简写:u 用户组权限,就是和你同组的人的权限。英文:group,简写:g 其他权限,就是不和你同组的人的权限。英文:others,简写:o - rwxrwxrwx 表示用户前线,用户组权限,其他权限都有读,写,可执行权限 r , 即Read,读,权限值为 4 w,即Write,写,权限值为 2 x,即Execute,执行,权限值为 1 开所有权限:数字 7 表示,即 7 = 4 + 2 + 1 - ,在标号 0 位置,表示普通的文件( - rwxrwxrwx) - ,其他位置,表示对应权限未开启,不具备权限( - rw - rw - r -- ) d,即directory,表示目录文件(drwxrwxrwx) - rw - rw - r -- 表示用户权限为:读、写;用户组权限:读、写;其他权限:读,不能写和执行 chmod 命令是用于改变文件或目录的访问权限。 + 表示增加权限,如 + x , u + x 等 - R 对当前目录下的所有文件与子目录进行相同的权限变更 # 常用于 脚本无权执行的情况 chmod + x * * . sh

neo4j 120 seconds error after copying graph.db permission

杀马特。学长 韩版系。学妹 提交于 2019-12-13 18:24:55
问题 This is my problem. I have copied graph.db for a backup. Neo4j was started when I did that. After that I deleted graph.db and neo4j started a new one. Neo4j is working fine, no problems. But when wanted to copy again graph.db (the backup one) I get: Starting Neo4j Server...WARNING: not changing user waiting for server to be ready... Failed to start within 120 seconds. I have uninstalled and installed again neo4j and it does not work. I think is a problem of permissions... If yes how to solve

How to chmod the folder to make it writable for the server in php

倖福魔咒の 提交于 2019-12-13 03:22:51
问题 How to chmod the folder to make it writable for the server in php ? I am using this function chomd as following chmod("/images/original", 0750); but still don't have the permission to write file . why ? 回答1: If the user your webserver runs on has no write access then it most likely is not the owner of the file, and therefore it cannot change permissions either. To allow write access on the file for your webserver process either change the ownership ( chown ) or allow sufficient write

Cocoa application won't run because Contents/MacOS/Application is not a Unix Executable

走远了吗. 提交于 2019-12-13 02:27:51
问题 My application runs fine on my system, and also on several others. However, some people can't run the application because the file in /Contents/MacOS/ApplicationName is not a Unix executable file. Inputting the following line in the terminal forces the application to be executable, and solves the problem: chmod +x ApplicationName Obviously this is a very hacky way around the problem, and I don't want to tell users to enter chmod to run my application. What am I doing wrong? Why is it

Execute permissions on downloaded file

五迷三道 提交于 2019-12-12 12:28:06
问题 I have made a script for installing a control panel. I've uploaded the script to a server so people can wget it to their machines. The only issue is that you have to chmod it after download. Is there a way to remove this step? How would I go about keeping 755 perms on the downloaded script? 回答1: When a user downloads the file, the file will automatically get some default permission. In UNIX, each user will have a default set of permissions which apply to all files created by that user, unless

Why can't my PHP script chmod a file it creates?

白昼怎懂夜的黑 提交于 2019-12-12 11:08:23
问题 I have a php that creates a file that needs to be executable (it's a batch file that needs to be run by the system). For some reason, even though the file is owned by apache and php is running as apache, and the file IS created, the script dies at the chmod line. What do I need to configure differently to allow the php to chmod the file it creates? Two lines above it happily creates a directory FOR this file which it chmods to 755 right as it creates it. Am I missing something obvious? my

linux中关于权限的一些事

大兔子大兔子 提交于 2019-12-12 09:35:59
权限这个东西对于初学者来说可能会有点陌生,不过不要紧,看完下面的讲解应该会对你有一定的帮助 权限 rwx rwx rwx rwx u g o a r:可读 4 w:可写 2 x:执行 1 -:没有权限 0 # chmod u=rwx,g=rw,o=r file(764) //设置文件拥有着读写执行权限,同组读写,其它用户只读权限 # chmod u-x file(664) //取消文件拥有者的执行权限。 # chmod g+x,o-r file //给同组用户增加执行权限,取消其他用户的可读权限。 #chmod a-r file //取消所有用户的读权限。 更改文件的拥有者和拥有组 chown [ -R ] ● 拥有者和拥有组中间使用 “.”或“:”进行分隔 ● 用户名和组名必须事先已经存在的。 chown 拥有者名.拥有组名 file //更变文件的拥有者和拥有组 chown 拥有者名 file //更变文件的拥有者 chown .拥有组名 file -R //处理指定目录以及其子目录下的所有文件 对于文件 r : cat head tail more less vi/vim w : > >> vi/vim gedit x : 意味着这个文件对于我来讲变成的脚本(命令) 对于文件夹(目录 ) r : 基本上没意义,只能知道这个文件夹中文件的名字。 w

Ruby (Errno::EACCES) on File.delete

核能气质少年 提交于 2019-12-12 09:11:56
问题 I am trying to delete some XML files after I have finished using them and one of them is giving me this error: 'delete': Permission denied - monthly-builds.xml (Errno::EACCES) Ruby is claiming that the file is write protected but I set the permissions before I try to delete it. This is what I am trying to do: #collect the xml files from the current directory filenames = Dir.glob("*.xml") #do stuff to the XML files finalXML = process_xml_files( filenames ) #clean up directory filenames.each do