umask

第十五章 特殊权限

人盡茶涼 提交于 2019-12-02 06:40:54
一.特殊权限: 1.suid(4000) SetUID(suid):会在属主权限位的执行权限上写个s 如果该属主权限位上有执行权限,则:s 如果该属主权限位上没有执行权限,则:S 授权方式: chmod u+s filename chmod 4755 filename SetUID总结: 1.让普通用户对可执行的二进制文件,临时拥有二进制文件的属主权限 2.如果设置的二进制文件没有执行权限,那么suid的权限显示就是S 3.特殊权限suid仅对二进制可执行程序有效,其他文件或目录则无效 注意:suid极其危险,不信可以尝试对vim或者rm命令进行设定suid 2.sgid(2000) [root@rlb ~]# ll /bin/write -rwxr-sr-x. 1 root tty 19624 Oct 31 2018 /bin/write 如果该属组权限位上有执行权限,则:s 如果该属组权限位上没有执行权限,则:S [root@db04 ~]# chmod 2755 /tmp/test/ [root@db04 ~]# chmod g+s /tmp/test/ SetGID的作用 1.针对用户组权限位修改,用户创建的目录或文件所属组和该目录的所属组一致。 2.当某个目录设置了sgid后,在该目录中新建的文件不在是创建该文件的默认所属组 3

linux系统属性及权限

岁酱吖の 提交于 2019-12-01 13:15:23
setuid 和setgid linux权限 ls -l结果中的第二列-rw xr-x r-x 用户 用户组 时间 文件名 r read读 w write 写 x 执行 对于文件来讲: r 读取文件内容 w 修改文件内容,删除文件的w无关 x 执行权限。文件本身就要可以执行,需要r配合 对于目录来讲: r浏览目录里内容的权限,需要x配合 w 创建删除目录文件的权限,和文件 x进入目录的权限 umask:控制linux系统默认权限的一个命令 file 644 dir 755 如何计算新umask下,文件和目录的默认权限 目录:777-umask= 文件:   umask的每个位都为偶数的情况,666-umask    来源: https://www.cnblogs.com/qhlove/p/11687822.html

apache and sftp permissions for wordpress automatic update in ubuntu [closed]

血红的双手。 提交于 2019-12-01 07:31:22
It's my first time trying to set up Wordpress or any website on a cloud hosting. I am on Ubuntu server, and Wordpress is located in var/www/mydomain/public folder. What I want to achieve is this: Both Wordpress (PHP) and SFTP users can access and modify the same files. And Wordpress should be able to do it's automatic update for plugins, etc. This is what I have done so far: I have chmodded this folder to 775 to allow group read/write permissions. I have added apache user (www-data) and SFTP user (suser) both to group wp. I have made wp as the group owner of all files inside the wordpress

apache and sftp permissions for wordpress automatic update in ubuntu [closed]

北城以北 提交于 2019-12-01 05:12:29
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . It's my first time trying to set up Wordpress or any website on a cloud hosting. I am on Ubuntu server, and Wordpress is located in var/www/mydomain/public folder. What I want to achieve is this: Both Wordpress (PHP) and SFTP users can access and modify the same files. And Wordpress should be able to do it's

Python循环定时服务功能(类似contrab)

跟風遠走 提交于 2019-12-01 03:28:45
Python实现的循环定时服务功能,类似于Linux下的contrab功能。主要通过定时器实现。 注:Python中的threading.timer是基于线程实现的,每次定时事件产生时,回调完响应函数后线程就结束。而Python中的线程是不能restart的,所以这种循环定时功能必须要在每次定时响应完成后再重新启动另一个定时事件。 #!/usr/bin/env python # -*- coding: utf-8 -*- # import subprocess from threading import Timer import time import os import sys if os.name == 'posix': def become_daemon(our_home_dir='.', out_log='/dev/null', err_log='/dev/null', umask=0o022): "Robustly turn into a UNIX daemon, running in our_home_dir." # First fork try: if os.fork() > 0: sys.exit(0) # kill off parent except OSError as e: sys.stderr.write("fork #1 failed: (%d) %s\n

权限管理

 ̄綄美尐妖づ 提交于 2019-11-30 19:01:01
基本权限管理 文件类型: -  普通文本文档 b  块设备文件 c  字符设备文件,如鼠标 d  目录文件 l  软链接文件 p  管道符文件 s  套接字文件 权限: r  读 w  写 x  执行 基本权限命令 chmod 修改文件的权限模式 [root@localhost~]# chmod [选项] 权限模式 文件名 选项:   -R  递归设置权限,也就是给子目录中的所有文件设定权限 赋予方式: +  加入权限 -  减去权限 =  设置权限 数字权限: 4  代表“r“权限 2  代表“w“权限 1  代表“x“权限 常用权限: 644  这是文件的基本权限,代表所有者拥有读、写权限,而所有组和其他人拥有只读 755  这是文件的执行权限和目录的基本权限,代表所有者拥有读、写和执行权限,而所属组和其他人拥有读和执行权限 777  这是最大权限。在实际的生产服务器中,要尽力避免给文件或目录赋予这样的权限,这会造成一定的安全隐患 注 :一般情况下,所有者权限>=所属组权限>=其他人权限 所有者和所属组命令 1.chown命令 修改文件和目录的所有者和所属组 [root@localhost~]# chown [选项] 所有者:所属组 文件或目录 选项:   -R  递归设置权限,也就是给子目录中的所有文件设定权限 2.chgrp命令 修改文件和目录的所属组的命令 注:

Linux-用户、组、权限

别说谁变了你拦得住时间么 提交于 2019-11-30 18:29:12
目录 用户、组、权限 ## 1.用户账号和群组账号的作用 1.1用户User 1.2组group 1.3用户和组的配置文件路径 * 1.4passwd文件格式 1.5shadow文件格式 1.6密码期限 ## 2.用户和群组管理的相关命令 2.1管理用户の相关命令 2.2切换用户 2.3设计密码 2.4用户密码政策 2.5创建组 2.6修改和删除组 2.7更改组密码 2.8更改和查看组成员 ## 3.理解并学会设置文件的权限 3.1文件属性 权限这里测试不要用root实验!!!!root太牛逼了 请用普通用户执行!!!!!测试文件、文件夹权限操作,请用普通用户 3.2修改文件的属主和属组 3.3文件权限操作 3.4修改文件权限 ## 4.默认权限 4.新建文件和目录的默认权限 @ 用户、组、权限 ## 1.用户账号和群组账号的作用 1.1用户User Linux用户:Username/UID 管理员:root,0 普通用户:1-60000,系统自动分配 系统用户:1-499,1-999(参考Centos7,多守护进程获取资源进行权限分配) 登录用户:500+,1000+(参考Centos7)(交互式登录) 1.2组group Linux组:Groupname/GID 管理员:root,0 系统组:1-499,1-999(参考Centos7) 普通组:500+,1000+

How to trace where php5-fpm umask settings are coming from on ubuntu

会有一股神秘感。 提交于 2019-11-30 06:52:43
I'd really appreciate any help in tracking down and diagnosing an umask issue on Ubuntu: I'm running php5-fpm with Apache via proxy_fcgi . The process is running with a umask of 0022 (confirmed by having PHP send the results of umask() into a file [the result is '18' == 0022]). I'd like to change this to 0002, but can't track down where the umask is coming from. Apache is set with umask 0002, and as a test, if I disable proxy_fcgi and run my test above, I get a file with u+g having rw access (and the file contents confirm the umask as '2' == 0002). If I sudo -iu fpmuser and run umask the

Git change default umask when update file

岁酱吖の 提交于 2019-11-30 06:26:21
问题 I have a problem with Git. I searched for a solution in Google and in StackOverflow but nothing helps. The problem is that every time git updates some file in the working directory (when I checkout branches or I merge a branch, etc.) then the file permissions are changed such that the "writable to group" flag is added. And my apache shows "Error 500" for the file if it is writable to group. Example: I have a file index.php. Permissions are "-rwxr-xr-x". Current (active) branch is master. This

How to create Unix Domain Socket with a specific permissions in C?

半世苍凉 提交于 2019-11-30 06:14:23
I have a simple code, like: sockaddr_un address; address.sun_family = AF_UNIX; strcpy(address.sun_path, path); unlink(path); int fd = socket(AF_UNIX, SOCK_STREAM, 0); bind(fd, (sockaddr*)(&address), sizeof(address)); listen(fd, 100); I want to atomically create the Unix Domain Socket file with a specific permissions, say: 0777 . The manual doesn't say anything about socket file permissions with regard to umask or whatever. Even, if the umask does affect the socket file, then it's not an atomic way - in multi-threaded program. I hope, there is a way to achieve my goal without using