chmod

Linux chmod命令详解

时间秒杀一切 提交于 2019-12-04 15:29:47
Linux chmod命令 Linux 命令大全 Linux/Unix 的文件调用权限分为三级 : 文件拥有者、群组、其他。利用 chmod 可以藉以控制文件如何被他人所调用。 使用权限 : 所有使用者 语法 chmod [-cfvR] [--help] [--version] mode file... 参数说明 mode : 权限设定字串,格式如下 : [ugoa...][[+-=][rwxX]...][,...] 其中: u 表示该文件的拥有者,g 表示与该文件的拥有者属于同一个群体(group)者,o 表示其他以外的人,a 表示这三者皆是。 + 表示增加权限、- 表示取消权限、= 表示唯一设定权限。 r 表示可读取,w 表示可写入,x 表示可执行,X 表示只有当该文件是个子目录或者该文件已经被设定过为可执行。 其他参数说明: -c : 若该文件权限确实已经更改,才显示其更改动作 -f : 若该文件权限无法被更改也不要显示错误讯息 -v : 显示权限变更的详细资料 -R : 对目前目录下的所有文件与子目录进行相同的权限变更(即以递回的方式逐个变更) --help : 显示辅助说明 --version : 显示版本 实例 将文件 file1.txt 设为所有人皆可读取 : chmod ugo+r file1.txt 将文件 file1.txt 设为所有人皆可读取 : chmod

How to chmod files within a python setup.py?

有些话、适合烂在心里 提交于 2019-12-04 14:55:03
I created a python package installation with a setup.py, and i want it to copy a data file in the folder (created for the occasion) ~/.did. The problem is that i have to call setup.py with sudo rights, as it writes in /usr/local/... So when my data file is copied in ~/.did, only the root user has write access to the file. I decided then to add a call to os.chmod() after the setup() function, but i'd like to know if anyone had a more clean way to do so. Here is my setup.py file : #!/usr/bin/env python from distutils.core import setup import os home=os.path.expanduser('~') setup(name='did',

Git changes the permissions on a single file unexplainably

[亡魂溺海] 提交于 2019-12-04 08:57:10
I am the only person involved with this git project. Every time I edit files at my local Ubuntu repository, then push to Bitbucket and pull to my production repository, git changes the edited files to -rwxrwxr-x 775. Apache doesn't like this. Local system: git version 1.8.1.2 on Ubuntu Linux Production system: git version 1.7.12 on CentOS/Red Hat Linux When I fix permissions to 755, then do git diff or git diff -p It shows nothing. At my local repository, the permissions are 755 and the files are all owned by haws. At my production repository, all other permissions stay at 755, and all files

NSFileManager & NSFilePosixPermissions

人盡茶涼 提交于 2019-12-04 07:42:47
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 wrong? Thanks for help. gcbrueckmann First, NSFilePosixPermissions is the name of a constant. Its value

How to create a directory and give permission in single command

泄露秘密 提交于 2019-12-04 07:29:32
问题 How to create a directory and give permission in single command in Linux? I have to create lots of folder with full permission 777 . Commands mkdir path/foldername chmod 777 path/foldername I don't like to create and give permission in two commands. Can I do this in single command? 回答1: According to mkdir's man page... mkdir -m 777 dirname 回答2: install -d -m 0777 /your/dir should give you what you want. Be aware that every user has the right to write add and delete files in that directory.

Simple PHP/HTML upload page - no files are saving

為{幸葍}努か 提交于 2019-12-04 06:43:25
问题 I'm new to HTML/PHP and I'm trying to create a simple php file upload page. I have this as my HTML <!DOCTYPE html> <html> <body> <form action="upload.php" method="post" enctype="multipart/form-data"> Select image to upload: <input type="file" name="fileToUpload" id="fileToUpload"> <input type="submit" value="Upload Image" name="submit"> </form> </body> </html> I have this as my php: <?php $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);

【原创】CentOS 7 安装解压版mysql5.7

落爺英雄遲暮 提交于 2019-12-04 06:07:34
1、将mysql压缩包解压至 /usr/local 文件夹下,将其改名为mysql #解压 tar -zxf mysql-5.7.27-el7-x86_64.tar.gz -C /usr/local/ #重命名 cd /usr/local/ mv mysql-5.7.27-el7-x86_64/ mysql 2、进入mysql,由于5.7没有data目录,自己创建一个 cd mysql/ mkdir data 3、创建mysql用户和用户组 [root@airflow mysql]# groupadd mysql [root@airflow mysql]# useradd -r -s /sbin/nologin -g mysql mysql -d /usr/local/mysql/ #useradd -r参数表示mysql用户是系统用户,不可用于登录系统 4、改变mysql目录权限,之前是root权限,现在设置成mysql权限 chown -R mysql:mysql /usr/local/mysql/ 5、初始化数据库 ./bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ 6、把mysql放到本地系统服务中 cp -a ./support

Deploying with capistrano does ignore group setting

好久不见. 提交于 2019-12-04 04:25:33
In my deploy-file I set the group to www-data: set :user, "root" set :group, "www-data" so when using cap:setup I expected capistrano to chown the folders with root:www-data But all folders and files are root:root. Any ideas where this problem could come from? Information: I'm Using system-wide-rvm. as for my understanding you should do it manually, what setup does is to use the user to login, not to set the rights to directory. I have found no group setting for capistrano, maybe you were using some extensions for it? What you could do to change it could be: after "deploy:setup", :setup_group

chmod a freshly mounted external drive to set up writing access

蹲街弑〆低调 提交于 2019-12-04 03:21:58
I have mounted a external drive at: # mkdir /mnt/external and subsequently: mkdir -p /mnt/external mount /dev/sdb1 /mnt/external Now only the root-user has access to write to these folders. linux-wyee:/home/martin # dir /mnt drwxr-xr-x 2 root root 4096 13. Dez 22:01 external How to change this - how to change that all can write to the external drive. I need to change the permissions within the terminal. chmod 777 /dev/sdb1 /mnt/external or something alike - Balaji Perumal Try this first, umount /dev/sdb1 chmod -R 0777 /mnt/external then mount with mount /dev/sdb1 /mnt/external or try chmod -R

linux下文件权限更改(转载)

谁都会走 提交于 2019-12-04 01:37:14
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 本文链接:https://blog.csdn.net/qq_33571752/article/details/83826758 文件权限 #####1.文件属性的查看 ls -l filename -|rw-r--r--.|1| root| root| 46 |Oct 1 05:03 |filename — ————————— — ———— ———— —— ———————————— ———————— 1 2 3 4 5 6 7 8 1."-":文件类型 - ##普通文件 d ##目录 c ##字符设备 s ##套接字 p ##管道 b ##快设备 l ##连接 2."rw-r--r--":文件读写权限 rw-|r--|r-- u | g | o u所有人的权限 g所有组的权限 o其他人的权限 3."1": 对文件:文件内容被系统记录的次数 对目录:目录中文件属性的字节数 4."root":文件所有人 5."root":文件所有组 6."46":文件内容的大小 7."Oct 1 05:03":文件最后一次被修改的时间 8."filename":文件名字 ####2.文件所有人所有组的管理 chown username file|dir ##更改文件的所有人 chgrp