chmod

Linux 下常用命令集锦--待续

谁说我不能喝 提交于 2019-12-06 11:30:04
1、查看系统版本及位数 系统版本 方法一: #lsb_release -a --该命令适用于所有的linux,包括Redhat、SuSE、Debian等发行版 方法二: #cat /etc/xxx-release ---XX为发行版名称。如 centos-release 方法三: #cat /etc/issue 位数 方法一: #uname -r 方法二: #more /proc/version 2、修改文件归属用户和组 一、基本知识 在Linux中,创建一个文件时,该文件的拥有者都是创建该文件的用户。该文件用户可以修改该文件的拥有者及用户组,当然root用户可以 修改任何文件的拥有者及用户组 。在Linux中,对于文件的权限(rwx),分为三部分,一部分是该文件的拥有者所拥有的权限,一部分是该文件所在用户组的用户所拥有的权限,另 一部分是其他用户所拥有的权限 。对于文件的权限请参考《 Linux的chmod命令 》 文件(含文件夹,下同)的权限,在shell中可以通过chmod命令来完成,关于此请参考 《 Linux的chmod命令 》 。 在 shell 中,可以使用 chown命令 来改变文件所有者及用户组, chgrp命令 来改变文件所在用户组。 在 Linux的 C程序 中,可以使用 chown函数 来改变文件所有者, 及 所在用户组。 另外, 在shell中,要

Work with app/console in Symfony at Mac OS X

孤者浪人 提交于 2019-12-06 10:44:30
问题 I've installed Symfony on Mac Os X and do: chmod -R 777 app/cache app/log Try do this: php app/console cache:clear And get back error: [RuntimeException] Unable to write in the "/Users/anton/Sites/local/Symfony/app/cache/dev" directory Try to fix it! Thanks! 回答1: If you are on Mac you can use ACL as it is explained here. From the project directory: sudo chmod +a "_www allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs sudo chmod +a "whoami allow delete,write,append

多分步构建Dockerfile(基于Alpine)

我们两清 提交于 2019-12-06 10:14:01
多分步构建Dockerfile(基于Alpine) 1.思路 如果引入其他镜像,直接from 在不引入镜像的时候,那么可以编写脚本,利用Dockerfile的COPY命令,拷贝本地目录到容器,然后在容器内执行安装脚本 2. 实施 文件目录结构: └── docker_alpine ├── config │ ├── dependent.sh │ ├── nginx.sh │ ├── pip_repositories.sh │ ├── python_packages.sh │ ├── python.sh │ └── repositories.sh └── Dockerfile # Dockerfile FROM alpine COPY config/ /config/ ENV CONFIG_PATH /config/ WORKDIR $CONFIG_PATH RUN chmod +x nginx.sh \ && chmod +x python.sh \ && chmod +x python_packages.sh \ && chmod +x repositories.sh \ && chmod +x pip_repositories.sh \ && chmod +x dependent.sh RUN sh repositories.sh \ && sh dependent.sh \ &

Linux常用命令总结

旧时模样 提交于 2019-12-06 08:44:34
自己简单总结的,希望对大家有帮助吧! 关机/重启 关机   poweroff //立即关机   shutdown -h now   //立刻关机   shutdown -h 时间 //到某个时刻自动关机   halt //立刻关机   init 0 //关闭系统   shutdown -c //取消定时关机   logout //注销   //简单说一下三个立刻关机的区别:poweroff是掉电关机,但实际上也是先关闭程序再关机,halt等同于shutodwn -h now是停掉系统而已,并没有掉电,主板是通电的 重启   shutdown -r now //立即重启 注意:关机和重启操作都是需要root权限的 系统信息 uname -r //查看系统内核版本 cat /proc/version //显示内核版本的详细信息 arch //查看系统处理器是32/64位 uname -m //等同于arch cat /proc/cpuinfo //查看cpu详细信息 date //显示系统时间 date +"时间显示格式" //按规定格式显示时间 clock -w //将系统时间写入硬件 cal 年 //查看某一年的日历 hostname //查看计算机名,后面可以加名称临时更改系统名称 cat /etc/redhat-release //查看系统版本 head /etc/issue

How to control file access in Windows?

江枫思渺然 提交于 2019-12-06 07:29:55
Go provides os.Chmod() for setting file and directory permissions. For example, if I want to ensure a file is accessible only to the current user, I can do the following: os.Chmod("somefile.txt", 0600) This works great on Linux but does absolutely nothing on Windows. After digging into the Go source code, I came across its implementation . It seems like S_IWRITE is the only attribute supported. How do I control access to a file or directory on Windows using Go? Explanation Windows does not use traditional Unix permissions. Instead, Windows controls access to files and directories through

FTP Rights 755 vs 777

删除回忆录丶 提交于 2019-12-06 03:02:01
问题 I know that 777 gives more write - rights, but can people who visit your site change your file when is has the 777 instead of 755? Sometimes it's enough when my file has the rights of 755, but I do sometimes 777, is that bad? People don't recommend it, but why? Can people access it when it is on 777? Or are there more things that I don't know? 回答1: A 777 permission on the directory means that everyone has access to read/write/execute (execute on a directory means that you can do a ls of the

NSFileManager & NSFilePosixPermissions

≡放荡痞女 提交于 2019-12-06 00:34:13
问题 I want to use the octal permissions (used for chmod) for NSFilePosixPermissions. Here is what I did now: NSFileManager *manager = [NSFileManager defaultManager]; NSDictionary *attributes; [attributes setValue:[NSString stringWithFormat:@"%d", 0777] forKey:@"NSFilePosixPermissions"]; // chmod permissions 777 [manager setAttributes:attributes ofItemAtPath:@"/Users/lucky/Desktop/script" error:nil]; I get no error, but when I check the result with "ls -o" the permission are't -rwxrwxrwx. What's

How to manage Linux file permissions in Java?

纵然是瞬间 提交于 2019-12-05 20:39:32
Is there any mechanism to get and set the file/directory permissions? For example, I want to show the permisssions of a file in a shell way: -rwxr-xr-- Is it possible to do this using Java? I know that there are some methods in the File class to know if the file canExecute , canRead and canWrite , but AFAIK this info is for the current user only. I need to know the whole octal number, for example 755, so I need to get it from the user, from group and from others. I know that Java7 brings Posix operations, but how could do this using a smaller JRE? I would like not to use a command like ls , or

PHP fails to chmod?

走远了吗. 提交于 2019-12-05 20:32:29
I'm running PHP 5.3.5-1ubuntu7.2 (with safe_mode = Off ) and I'm unable to correctly set the mode for any file or directory from within a PHP script, I coded the following test (just to make sure): $result = array(); if (mkdir('./I/do/not/exist/', 0777, true) === true) { $result['./I/'] = sprintf('%s (%s)', getFileOwner('./I/'), getFilePermissions('./I/')); $result['./I/do/'] = sprintf('%s (%s)', getFileOwner('./I/do/'), getFilePermissions('./I/do/')); $result['./I/do/not/'] = sprintf('%s (%s)', getFileOwner('./I/do/not/'), getFilePermissions('./I/do/not/')); $result['./I/do/not/exist/'] =

Linux基础权限管理篇一

不想你离开。 提交于 2019-12-05 20:27:43
一、权限概述 Linux系统一般将文件可存/取访问的身份分为3个类别:owner(拥有者)、group(和所有者同组的用户)、others(其他人,除了所有者,除了同组的用户以及除了超级管理员), 且三种身份各有read(读),write(写)、execute(执行)等权限 二、权限介绍 在多用户(可以不同时)计算机系统的管理中,权限是指某个特定的用户具有特定的系统资源使用权力。像是文件夹、特定系统指令的使用或存储量的限制。 在Linux中分别有读,写,执行权限。 读权限: 对于目录来说,读权限影响用户是否能够列出目录结构 对于文件来说,读权限影响用户是否可以查看文件内容 写权限: 对于目录来说,影响用户是否可以执行cd命令 对于文件来说,特别是脚本文件,执行权限影响文件是否可以运行 三、身份介绍 owner(文件所有者) 由于linux是多用户,多任务的操作系统,因此可能常常有很多人同时在一台主机上工作,但每个人均可在主机上设置文件的权限,让其成为个人的“私密文件”,即个人所有者,因为设置了适当 的文件权限,除本人(文件所有者)之外的用户无法查看文件内容。 Group身份(与文件所有者同组的用户) 与文件所有者同组最有用的功能就体现在多个团队在同一台主机上开发资源的时候,例如主机上有A,B两个团体(用户组),A中有a1,a2,a3三个成员,B中有b1,b2两个成员,