chmod

特殊权限 - SUID GUID STICKYBIT

試著忘記壹切 提交于 2019-12-20 00:02:21
◆  SUID ( Set User ID ) Linux里,用户的ID被称作UID。在实际生产中,可能需要临时借用别的用户执行程序,因此需要能够临时变更自己UID的机能叫做SUID。借助SUID权限,用户可以临时调用root权限。 ※ 通常,文件的执行是由所属者发起,然而,赋予SUID权限后可临时继承所有者的权限(来执行文件)。通常用于二进制可执行文件上,文件夹赋予该权限无意义。 举个例子,假如我们要变更密码、需要编辑/etc/shadow文件,然而这个文件一般用户并没有修改权限。但由于更改密码的命令 passwd拥有SUID权限、一般用户就可以通过该命令来(继承root的权限进而)更改密码。同时我们也可以看到在ll命令下,拥有SUID权限的文件,执行权限的位置会由x变为s。 $ ls -l /usr/bin/passwd -rwsr-xr-x. 1 root root 25980 Sat 07 2018 /usr/bin/passwd 从上面的命令中可以看到,所有者的权限显示为rws,其中,执行权变成了s。也就是说,有执行该命令权限的而用户可以临时继承所有者(root)的权限。 需要通过chmod来赋予(二进制可执行)文件SUID时,可通过添加数字“4000”来赋予权限。比如,原来的权限为755(rwx r-x r-x),赋予SUID权限后变成4755,即(rws r-x r

Can't use ansible inventory file because it is executable

谁说我不能喝 提交于 2019-12-19 07:21:53
问题 I am trying to run an Ansible inventory file ansible -i hosts-prod all -u root -m ping and it is failing with this message: ERROR: The file hosts-prod is marked as executable, but failed to execute correctly. If this is not supposed to be an executable script, correct this with `chmod -x hosts-prod`. I believe this is because I am using Virtual Box and shared folders which is forcing all my files to ug+rwx. And vbox does not permit changing permissions on shared folders (at least shared

Linux学习之权限管理

佐手、 提交于 2019-12-19 04:35:23
目录 基本权限管理 更改文件和文件夹的权限 更改文件的属主和属组 特殊权限管理 ACL权限管理 隐藏权限管理 基本权限管理 更改文件和文件夹的权限 chmod 更改文件的权限 u 设置属主的权限 chmod u+r file g 设置属组的权限 chmod g-x file o 设置其他人的权限 chmod o = w file a 设置所有人的权限 chmod a+r file chmod +r file + 增加权限 chmod u+r,g-x,o = w,a+r file - 删除权限 = 赋值权限 r 可读权限 4 chmod 421 file == chmod u+r,g+w,o+x file w 可写权限 2 chmod 777 file == chmod a+rwx file x 可执行权限 1 chmod 700 file == chmod u = rwx,g = -,o = - file - 没有权限 0 没有权限 -R 递归修改权限,修改目录下所有文件的权限 chmod -R a = rwx . ( 表示对当前目录下所有的文件的属主、属组、其他人的权限都设置为rwx ) 更改文件的属主和属组 chown 更改文件的属主和属组 chown u.g file 设置file的属主为u属组为g chown u. file 设置file的属主和属组都为u chown .g

Linux组管理和权限管理

时间秒杀一切 提交于 2019-12-18 20:52:33
⒈Linux组基本介绍   1)在Linux中的每个用户必须属于一个组,不能独立于组外。   2)Linux中每个文件都有所有者、所在组、其它组的概念     ①所有者     一般(默认)为文件的创建者,谁创建了该文件,就自然的成为该文件的所有者     相关指令:       ⅰ ls -ahl         查看文件的所有者       ⅱ chown 用户名 文件名         修改文件的所有者     ②所在组     当某个用户创建了一个文件后,该用户所在的组默认成为了该文件的所在组     相关指令:       ⅰ groupadd 组名称         创建组       ⅱ ls -ahl         查看文件/目录所在组       ⅲ chgrp 组名 文件名         修改文件所在的组       ⅳ usermod -g 组名 用户名         改变用户所在组,在添加用户时,可以指定将该用户添加到那个组中,同样的用root管理权限可以改变某个用户所在的组。       ⅴ usermod -d 目录名 用户名         改变某用户登录的初始目录     ③其他组     除文件的所有者和所在组的用户外,系统的其他用户都是文件的其他组 ⒉权限的基本介绍   ls -l中显示的内容如下:        说明:     第0位

Differences between CHMOD 755 vs 750 permissions set

帅比萌擦擦* 提交于 2019-12-18 18:48:35
问题 I have some files with 755 and i need to change them to 750, but i am not sure if this can affect some process. I am changin JARs, XMLs, LOGs and properitees files. Can someone explain to me the difference between these two permission set? Thanks! 回答1: 0755 = User: rwx Group: r-x World: r-x 0750 = User: rwx Group: r-x World: --- (i.e. World: no access) r = read w = write x = execute (traverse for directories) 来源: https://stackoverflow.com/questions/19547085/differences-between-chmod-755-vs

Linux 权限管理

匆匆过客 提交于 2019-12-18 16:12:54
Linux下一切都被抽象成了file,哪些进程可以访问哪些file,不可以访问哪些file,就是权限管理。 每个file都有权限属性,可以用 ls -l 查看file的权限属性。 3对rwx分别代表,用户,组,其他人的rwx。 $ ls -l drwxrwxr-x. 2 ys ys 28 Nov 29 17:47 a file通过自己的权限属性来保护自己,让符合自己权限属性的进程访问,让不符合自己权限属性的进程不能够访问。 权限属性是由权限位构成的,权限位(drwxrwxr-x等)说明表: 文件类型位 用户的读权限位 用户的写权限位 用户的可执行权限位 主组的读权限位 主组的写权限位 主组的可执行权限位 其他用户的读权限位 其他用户的写权限位 其他用户的可执行权限位 user group d r w x r w x r - x ys ys 3组rwxrwxrwx叫mode,使用 chmod 修改mode。 user,group叫ownership, 文件: r:可以获取file的元数据和数据内容 w:可以修改file的元数据和数据内容 x:可以运行此文件 目录: r:可以用 ls 命令获取目录里的内容列表,但不能使用 ls -l 获取目录里的详细内容列表。 w:可以在目录里,创建,删除文件。 x:可以cd到此目录,如果也有读权限,则可以使用 ls -l 获取目录里的详细内容列表。

Chmod for PHP web application

对着背影说爱祢 提交于 2019-12-18 11:38:54
问题 Im writing web application. It's have: index.php /app - of course, with .htaccess but im not talking about it /app/session - for sessions, session_save_path(/app/session) must be used on my server /app/include - index.php includes files from this directory /app/config - only .xml files, that files reads classes from scripts in include /images, /styles etc. My question is: What is correct chmod settings for above directories? I know what is chmod (im working on Linux) and I know how I can

How do I make git accept mode changes without accepting all text changes?

主宰稳场 提交于 2019-12-18 11:00:28
问题 I've got the opposite problem from "How do I make Git ignore file mode (chmod) changes?" I've got a file that I've changed executable permission on, but there are also some text changes, and I want to commit the former but not the latter. Is this possible with git? (Actually, I've made some text changes I want to commit along with the executable permission change, and others I don't want to commit) Update: Unstaging the text changes to the file, and then doing git add -p again and

Linux 命令失去执行权限

Deadly 提交于 2019-12-18 02:18:54
环境: Centos7 背景: 可能平时因为一些误操作,导致了chmod命令失去了执行权限,无法使用chmod改变文件的权限。 方法: 使用setfacl命令进行补救。 setfacl - m u:root:rwx / usr / bin / chmod chomd + x / usr / bin / chmod setfacl - b / usr / bin / chmod 来源: CSDN 作者: 超大玉螺旋丸 链接: https://blog.csdn.net/qq_38534191/article/details/103584913

5.Linux权限与归属

时光怂恿深爱的人放手 提交于 2019-12-18 02:00:54
一.基本权限 1.基本权限的类别 ①读取: r ead,允许查看内容 ②写入: w rite,允许修改内容,可以执行rm,mv,cp,mkdir等操作 ③可执行:e x ecute,允许运行和切换,能够cd切换进目录 权限使用对象(归属关系) 所有者(属主): u ser 拥有此文件/目录的用户 所属组(属组): g roup 拥有此文件/目录的组 其他人: o ther 除了所有者.所属组以外的用户 2.查看权限 命令:ls -ld 文件或目录 以-开头为文本文件 以d开头为目录 以l开头为快捷方式 3.设置基本权限: chmod [-R] 归属关系+-=权限类别 文档... eg: [root@server0 ~]# mkdir /nsd01 [root@server0 ~]# ls -ld /nsd01 [root@server0 ~]# chmod u-w /nsd01 [root@server0 ~]# ls -ld /nsd01 [root@server0 ~]# chmod g+w /nsd01 [root@server0 ~]# ls -ld /nsd01 [root@server0 ~]# chmod o=--- /nsd01 [root@server0 ~]# ls -ld /nsd01 [root@server0 ~]# chmod u=rwx,g=r,o=w