chmod

02、用户管理

我的梦境 提交于 2019-11-26 19:36:34
用户管理 用户分类: 按系统分: 根用户 (管理员)  用户 id为0,如root 系统用户  用户 id在 1-499 之间 这些用户主要是系统内置的一些程序或服务使用的   普通用户 管理员创建的,使用、登录系统的用户 用户 id 一般从 500 开始 按作用分: 管理员 普通成员 用户识别不是靠用户名的,而是用户 id (uid) 与用户和组相关的配置文件 /etc/passwd 帐号 /etc/shadow   密码 /etc/group 组名 /etc/gshadow 组密码 /etc/login.defs 帐号限制文件 /etc/default/useradd 新建用户的默认规则文件 /etc/skel 默认用户家目录模板 /etc/passwd 文件解释 root:x:0:0:root:/root:/bin/bash tom:x:500:500::/home/tom:/bin/bash mary:x:501:501::/home/mary:/bin/bash 文件由冒号分隔成7段 第一段:用户名 第二段:密码, x 表示密码放在 /etc/shadow 为空表示登录不要密码也有把密码直接放在这里了,但这样,不太好      第三段:用户 id 第四段:组 id (主要组) 第五段:注释、描述 第六段:家目录 第七段:使用的 shell 如果是 nologin

Change all files and folders permissions of a directory to 644/755

三世轮回 提交于 2019-11-26 18:42:02
问题 How would I change all files to 644 and all folders to 755 using chmod from the linux command prompt? (Terminal) 回答1: One approach could be using find: for directories find /desired_location -type d -print0 | xargs -0 chmod 0755 for files find /desired_location -type f -print0 | xargs -0 chmod 0644 回答2: The easiest way is to do: chmod -R u+rwX,go+rX,go-w /path/to/dir which basically means: to ch ange file mod es -R ecursively by giving: u ser: r ead, w rite and e X ecute permissions, g roup

Creating executable files in Linux

最后都变了- 提交于 2019-11-26 18:03:39
问题 One thing I plan to be doing is writing (painfully simple) Perl scripts, and I'd like to be able to run them without explicitly calling Perl from the terminal. I appreciate that, to do this, I need to grant them execute permissions. Doing this with chmod is easy enough, but it also seems like a slightly laborious extra step. What I would like is one of two things: Firstly, is there a way to set the execute flag when saving a file? Currently I'm experimenting with gedit and geany, but would be

Chmod 777 to a folder and all contents [duplicate]

夙愿已清 提交于 2019-11-26 17:52:56
问题 This question already has an answer here: How do I change permissions for a folder and all of its subfolders and files in one step in Linux? [closed] 16 answers I have a web directory /www and a folder in that directory called store . Within store are several files and folders. I want to give the folder store and all files and folders within the store folder all permissions. How do I do this? I am guessing via .htaccess. 回答1: If you are going for a console command it would be: chmod -R 777

How will a server become vulnerable with chmod 777?

主宰稳场 提交于 2019-11-26 17:27:24
问题 I often read articles saying something along the lines of chmod 777 is bad! I was wondering: How do I become vulnerable when I execute chmod 777 on a file? What is a real world example of this that I can reproduce? 回答1: It allows filesystem content to be viewed and/or modified by anyone : assuming the attacker already has general system access which is very common on shared hosting platforms .. some are more "hardened" than others from the start. Here is a small incomplete list of possible

权限管理

泪湿孤枕 提交于 2019-11-26 17:13:42
Linux文件系统权限: 权限对象: ​ 文件拥有者 ​ 群组 ​ 其他人 权限类型: d rwxr-xr-x. 5 root root 4096 Jul 27 17:26 test **r:4;w:2;x:1;**r–r--r–:444;rw-rwx-r:674; rwx 权限说明: 1.对于文件而言 ​ r :可以获取文件的数据 ​ w :可以修改文件数据 ​ x :可以将此文件运行为进程 2.对于目录而言 ​ r:可以使用ls命令获取文件列表 ​ w:可以修改文件列表,即创建和删除 ​ x:表示我们可以cd此目录,并且可以使用ls -l获取文件的详细属性 权限判断逻辑: 文件:前提条件,用户能够进入到文件所在目录 (1)删除文件:看用户是否具备对目录的w权限 判断用户身份,owner-group-other rwxr(左三位)-xr(中三位)-x(右三位) (2) 创建文件和删除文件逻辑相同 2.目录:前提条件:判断用户是否能够成功进入目录所在目录**(**x权限) (1)删除目录:看用户是否具备对目录的x权限 判断用户身份,owner-group-other rwxr(左三位)-xr(中三位)-x(右三位) (2) 创建和删除逻辑相同 权限管理命令: chmod ​ chmod [OPTION]… MODE[,MODE]… FILE… ​ chmod [OPTION]…

【Linux下权限控制之chmod与chown命令】 -- 2019-08-09 10:49:48

一笑奈何 提交于 2019-11-26 16:08:15
原文: http://106.13.73.98/__/91/ chmod 用于配置文件/目录权限 命名格式: chmod [选项] 文件/目录名 . 权限类别: r 读取 可用数字 4 表示 w 写入 可用数字 2 表示 x 执行 可用数字 1 表示 . 归属类别: u 属主 g 属组 o 其它 a 所有人 . 操作符: + 给指定类别添加指定权限(例如+x或a+x表示允许所有人执行) - 删除指定类别的指定权限 = 重新定义指定类别的指定权限 . 示例 : chmod 755 file 给file文件重新定义权限为:属主rwx,属组rx,其它rx chmod -R a-w file 递归删除file目录及子目录的所有w权限 chown 用于更改文件/目录的属主和属组 命令格式: chown [参数] 用户名.组名 file 参数的话可使用 -R 递归,原理同上示例 原文: http://106.13.73.98/__/91/ 来源: https://www.cnblogs.com/gqy02/p/11325771.html

How do I give PHP write access to a directory?

落爺英雄遲暮 提交于 2019-11-26 16:01:37
I'm trying to use PHP to create a file, but it isn't working. I am assuming this is because it doesn't have write access (it's always been the problem before). I tried to test if this was the problem by making the folder chmod 0777, but that just ended up making every script in that directory return a 500 error message until I changed it back. How do I give PHP write access to my file system so it can a create a file? Edit: It is hosted on Hostgator shared hosting using Apache. Edit 2: Someone asked for the code: The code is a GD image script. I know the rest of it works as previously I was

In a PHP / Apache / Linux context, why exactly is chmod 777 dangerous?

蹲街弑〆低调 提交于 2019-11-26 15:19:31
Inspired by the discussion in this question , a maybe stupid question. We have all been taught that leaving directories or files on Linux-based web hosting with the permission level of 777 is a bad thing, and to set always as little permissions as necessary. I am now curious as to where exactly lies the danger of exploitation, specifically in a PHP / Apache context. After all, a PHP script file can be executed from the outside (i.e. through a call to the web server, and subsequently to the interpreter) no matter whether it is marked as "executable", can't it? And the same applies to files

Cannot change permissions of folders within vagrant home folder

两盒软妹~` 提交于 2019-11-26 15:15:20
问题 When I ssh in to my vagrant vm, I can change permissions of files and folders above and outside the vagrant user folder, and for files within the vagrant user folder. But cannot change permissions for folders under the vagrant user folder. I have the same problem whether logged in as the vagrant user and root. Is there some sort of restriction on changing permissions in the vagrant user's folder? The vagrant user folder is not shared with the host OS, but the capistrano deploy folder and the