chmod

PHP: get_current_user() vs. exec('whoami')

戏子无情 提交于 2019-11-29 01:28:34
Short version of the question: What's the difference between get_current_user(); and exec('whoami'); ? Long version of the question: I'm on a XAMPP Localhost on a Mac. I'm using Apache, building a PHP based website in a folder (let's call it folderxyz ) within the htdocs folder (var/www in some flavors of Linux+Apache). I was playing around with a database connection, testing out PDO::ERRMODE_EXCEPTION described here: Link And I got this error: file_put_contents( PDOErrors.txt ): failed to open stream: Permission denied... So I did some sleuthing around and it seems that to fix this I need to

linux 如何改变文件属性与权限1

被刻印的时光 ゝ 提交于 2019-11-29 00:33:29
我们知道档案权限对于一个系统的安全重要性,也知道档案的权限对于使用者与群组的相关性, 那如何修改一个档案的属性与权限呢? 我们这里介绍几个常用于群组、拥有者、各种身份的权限的指令。如下所示: chgrp : 改变档案所属群组 chown : 改变档案拥有者 chmod : 改变档案的权限, SUID, SGID, SBIT等等的特性 1. 改变所属群组, chgrp [root@www ~]# chgrp [-R] dirname/filename ... 选项与参数: -R :进行递归(recursive)的持续变更,亦即连同次目录下的所有档案、目录都更新成为这个群组之意。常常用在变更某一目录内所有的档案之情况。 范例:[root@www ~]# chgrp users install.log [root@www ~]# ls -l -rw-r--r-- 1 root users 68495 Jun 25 08:53 install.log [root@www ~]# chgrp testing install.log chgrp: invalid group name `testing' <== 发生错误信息息啰~找不到这个群组名~ 2. 改变档案拥有者, chown [root@www ~]# chown [-R] 账号名称 档案或目录 [root@www ~]# chown

chmod: cannot read directory `.': Permission denied [closed]

廉价感情. 提交于 2019-11-29 00:09:10
问题 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 6 years ago . I am trying to recursively change the permission of directories and sub-directories for "data" directory and running into following error..can someone provide inputs on the below error? <username:/local/mnt/workspace/data>chmod -R 0644 . chmod: cannot read directory `.': Permission denied 回答1: Directories need

What is the normal chmod?

我的未来我决定 提交于 2019-11-28 22:11:30
问题 On my web server, my file permissions are all over the place and I want to 'reset' everything back to how it originally was. I don't want any users to be able to come in and delete things off my web server! I just want them to be able to look at php pages etc. What chmod should I use? 回答1: They should be as restrictive as possible, but no more. Usually 0644 is a good choice, which gives the owner read and write rights, but everybody else only read. 0755 for directories. But, it can depend on

Linux 修改文件目录权限

ぐ巨炮叔叔 提交于 2019-11-28 22:07:23
修改文件目录权限 chmod ​ chmod u+x b.txt chmod 777 a.txt 修改文件的所有者和所属组 ​ 修改所有者chown beifeng a.txt 修改所属组chgrp beifeng a.txt 修改所有者和所属组chown root:root a.txt 来源: https://www.cnblogs.com/chuhongyun/p/11429036.html

Linux系统chmod 777 误操作目录权限 - 恢复方法

给你一囗甜甜゛ 提交于 2019-11-28 21:44:02
小白操作Linux,手抖导致误修改了系统文件和目录权限,导致系统宕机的修复。 chmod 777 -R / chmod 777 -R / test 有的是真不懂,执行了上面的第一条命令,有的是懂,但是操作太快或者粗心大意,或者有乱敲空格的恶习,诸如此类... 不胜枚举,总之闯祸了。 Linux 中,如果意外误操作将根目录目录权限批量设置,比如 chmod -R 777 / ,系统中的大部分服务以及命令将无法使用,这时候可以通过系统自带的 getfacl 命令来拷贝和还原系统权限,若是其他系统目录被误操作,同样可行。 修复的方法如下: # 1、通过一台权限正常的 Linux(最好内核版本和故障服务器相同) 通过命令: getfacl -R / >systemp.bak # 将这个正常系统的/目录下所有文件的权限都备份保存在 systemp.bak 中。 # 2、如果异常服务器未重启等操作并且连接未端,可以使用 scp 命令将正常的备份文件传至异常服务器中,命令如下: scp root@目标机器 IP:system.bak 文件路径 本地存放 system.bak 路径 # 也可用其他方法把 systemp.bak 移动到异常服务器中。 # 3、在异常服务器中执行命令: setfacl --restore=systemp.bak # 即可将现在的系统权限恢复成和正常系统一样。 4

How do i secure a web server's image upload directory?

雨燕双飞 提交于 2019-11-28 17:06:24
For my web application, people can upload images from a web form to my web server. What should I set the CHMOD settings for that image upload directory so that people can upload images (from the web server) to that directory but not execute any files they upload for security reasons. Would the chmod settings be? : chmod 744 directory/ There are two possible meanings for "executable" in this context, and both are things you need to configure against. An executable binary file that may run from the command line by typing the file's name into a shell A file that may be read and processed as

Python module os.chmod(file, 664) does not change the permission to rw-rw-r— but -w--wx----

拟墨画扇 提交于 2019-11-28 16:55:42
Recently I am using Python module os, when I tried to change the permission of a file, I did not get the expected result. For example, I intended to change the permission to rw-rw-r--, os.chmod("/tmp/test_file", 664) The ownership permission is actually -w--wx--- (230) --w--wx--- 1 ag ag 0 Mar 25 05:45 test_file However, if I change 664 to 0664 in the code, the result is just what I need, e.g. os.chmod("/tmp/test_file", 0664) The result is: -rw-rw-r-- 1 ag ag 0 Mar 25 05:55 test_file Could anybody help explaining why does that leading 0 is so important to get the correct result? RedBaron Found

【Linux下权限控制之chmod与chown命令】

柔情痞子 提交于 2019-11-28 16:29:54
原文: http://blog.gqylpy.com/gqy/316 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://blog.gqylpy.com/gqy/316 来源: https://www.cnblogs.com/ggg566/p/11415572.html

Linux用户操作

二次信任 提交于 2019-11-28 16:09:39
多用户操作 Linux的特点之一就是支持多用户操作,学习Linux,当然要先知道它的特点   用户里面最牛的就是root用户(超级用户),它可以更改任何内容,不受权限限制,root用户登陆后系统的提示符是#,其他用户则为$   切换虚拟终端Ctrl+Alt+F[1~6] 利用切换终端可以实现多用户登陆,如果你的Linux是图形界面,右键打开两个终端也是一样的   useradd Tom  创建Tom用户   passwd Tom  给Tom更改密码(新创建的用户默认是没有密码的 只能root用户 普通用户只能改自己的密码 命令为 passwd+回车)   passwd -d Tom  清除Tom用户的密码,关闭使用者的密码认证功能, 使用者在登入时将可以不用输入密码   su Tom     可以从其他用户切换为Tom用户,(如果是从root用户切换不需要密码,其他用户切换需要输入密码)   exit       退出 如果你切换为一个用户,此命令可以一层一层退出用户的登录状态 例 root -> Tom -> Mark 这时用exit会返回Tom的登陆状态   userdel -r Tom 删除Tom用户 -r是指递归进行 用户配置文件   创建一个用户会在以下文件中新增该用户的配置文件     (1) /etc/passwd 用户信息文件