chmod

Linux 服务器如何设置文件和文件夹的读写权限

有些话、适合烂在心里 提交于 2019-12-01 12:10:13
修改文件可读写属性的方法 例如:把index.htm 文件修改为可写可读可执行: chmod 777 index.htm 要修改目录下所有文件属性可写可读可执行: chmod 777 *.* 该命令中可以使用 * 作为通配符。 比如:修改所有htm文件的属性: chmod 777 *.htm 修改文件夹属性的方法 把目录 /images/small 修改为可写可读可执行: chmod 777 /images/small 修改目录下所有的文件夹属性: chmod 777 * 把文件夹名称用 * 来代替就可以了。 要修改文件夹内所有的文件和文件夹及子文件夹属性为可写可读可执行: chmod -R 777 /upload 文件和目录的权限区别 总结 Linux 下文件和目录的权限区别: 文件:读文件内容(r)、写数据到文件(w)、作为命令执行文件(x)。 目录:读包含在目录中的文件名称(r)、写信息到目录中去(增加和删除索引点的链接)、搜索目录(能用该目录名称作为路径名去访问它所包含的文件和子目录) 具体说就是: (1)有只读权限的用户不能用 cd 进入该目录,还必须有执行权限才能进入。 (2)有执行权限的用户只有在知道文件名,并拥有读权利的情况下才可以访问目录下的文件。 (3)必须有读和执行权限才可以 ls 列出目录清单,或使用 cd 命令进入目录。 (4)有目录的写权限,可以创建

c copy file permissions from another file

末鹿安然 提交于 2019-12-01 09:20:18
What's the simplest way to copy the unix file permissions of a file and set them to another file? Is there a way to store a file's permissions to a variable and then use that variable to set those permissions to another file? Sure. Use stat() and chmod() (may need root). #include <sys/stat.h> struct stat st; stat("/foo/bar.txt", &st); chmod("/baz/quirk.jpg", st.st_mode); 来源: https://stackoverflow.com/questions/16680302/c-copy-file-permissions-from-another-file

chmod 777 in php

こ雲淡風輕ζ 提交于 2019-12-01 08:41:29
If I create a folder in php with mkdir() it has the www-data : www-data user and 755 permissions. The problem is I can't delete this folder with the ftp-user (zapbe:psasrv) I tried to modify the folder with chmod($path, "0777") in php but this doesn't work. How can I make the created folders and uploaded files readable / removeable for both the www-data and the ftp-user? bool chmod ( string $filename , int $mode ) Within PHP they might be some limitations on the security, therefore the depending on your configuration it may not work. The above function returns a booleon to let you know either

软件测试从业者必备的高频Linux命令

谁说我不能喝 提交于 2019-12-01 08:15:15
命令 cd \1. 如何进入上级目录 cd .. \2. 如何进入当前用户主目录 cd ~ \3. 如何进入上两级目录 cd ../.. \4. 进入当前目录命令 cd . \5. 如何进入目录 /usr/isTester cd /usr/isTester / 命令 mv \1. 移动一个文件夹(isTester文件夹,移动到/APP/www目录) mv ~/isTester/ /APP/www \2. 移动一个文件(isTester.ini 移动到/APP/www目录) mv isTester.ini /APP/www \3. 当前目录istester.tar.gz 移动到 /usr/ido 目录,并重命名为istester1228.tar.gz mv isTester.tar.gz /usr/ido/ido.tar.gz \4. 移动文件到上级目录 mv isTester.tar.gz ../ \5. 一条命令,移动两个文件 isTester.tar idoxu.tar 到目录 /APP/www mv isTester.tar idoxu.tar -t /APP/www / 命令 cp \1. 复制当前目录部署包isTester.tar.gz 到备份目录/APP/www/bak 目录 cp isTester.tar.gz /APP/www/bak \2. 复制文件夹

nvidia-tegra tx2 gcc: internal compiler error: Killed (program cc1plus)

僤鯓⒐⒋嵵緔 提交于 2019-12-01 07:52:05
一般为 out of memory tail -f 100 /var/log/syslog 找对应时间点是否有 out of memory 错误 建立临时缓冲去来解决 sudo dd if=/dev/zero of=/swapfile bs=64M count=16 sudo mkswap /swapfile chmod 0600 /swapfile sudo chmod 0600 /swapfile sudo swapon /swapfile 删除缓冲区 sudo swapoff -a sudo rm -rf /swapfile vim /etc/fstab # comment swapfile line 来源: https://www.cnblogs.com/llllIIIIllll/p/11670739.html

SHELL脚本

蓝咒 提交于 2019-12-01 07:51:45
一、shell脚本定义   shell是一种特殊的交互式工具,它为用户提供了启动程序、管理文件系统中文件以及运行在系统上的进程的途径。shell一般是指命令行工具。它允许你输入文本命令,然后解释命令,并在内核中执行。shell脚本,也就是用各类命令预先放入到一个文本文件中,方便一次性执行的一个脚本文件。   Mac电脑自带的shell脚本是bash。 二、脚本执行相关命令 $ source FileName 意思:在当前shell环境中读取并执行FileName中的命令 特点:命令可以强行让一个脚本去立即影响当前的环境(一般用于加载配置文件)。    命令会强制执行脚本中的全部命令,而忽略文件的权限。 $ bash FileName 、 $ zsh FileName 意思:重新建立一个子shell,在子shell中执行脚本里面的句子 $ ./FileName 意思:读取并执行文件中的命令。但有一个前提,脚本文件需要有可执行权限。chmod +x 查看当前电脑有多少个shell命令: cd /private/etc cat shells 三、用户、组、权限   Unix和Linux都是多用户、多任务的系统,所以这样的系统里面就拥有了用户、组的概念。那么同样文件的权限也就有相应的所属用户和所属组了。 【 权限 】 【连接】【所有者】 【所属组】 【文件大小】 【最后修改日期】

ubuntu 之权限修改问题(二)

家住魔仙堡 提交于 2019-12-01 07:51:13
今天我在我的笔记本上装了ubuntu,又犯了同样的错误,就是使用了如下命令: sudo su password cd usr/bin chmod 777 * -R 结果我的sudo又不能用了,提示sudo:must be setuid root 在网上搜到如下方法: ls -l /usr/bin/sudo chown root:root /usr/bin/sudo chmod 4755 /usr/bin/sudo reboot 我测试后的结论是,这个方法是可行的,但没有说清楚,需要有root的执行权限,如果不能以root身份登陆, 则需要进入到recovery模式,进入方法为:在开机的过程中按shift或ESC键,我ubuntu12.04系统是shift键。 然后在grub菜单中选择第二个启动项,进入到下一个选择列表界面后,再选中有root字样的一项,按回车, 此时,已经进入到具有root权限的字符界面。输入上述命令,如果问题已解决,那大功告成,可以跳过下面内容 我又遇到一个新问题,在此字条界面输入上面的 chown root:root /usr/bin/sudo chmod 4755 /usr/bin/sudo时,执行失败, 提示read-only file system,然后又上网找,找了N久,测了很多方法,最后找到一个重新挂载/目录以及指定其读写权限的命令。命令如下:

chmod 777 in php

。_饼干妹妹 提交于 2019-12-01 06:53:51
问题 If I create a folder in php with mkdir() it has the www-data : www-data user and 755 permissions. The problem is I can't delete this folder with the ftp-user (zapbe:psasrv) I tried to modify the folder with chmod($path, "0777") in php but this doesn't work. How can I make the created folders and uploaded files readable / removeable for both the www-data and the ftp-user? 回答1: bool chmod ( string $filename , int $mode ) Within PHP they might be some limitations on the security, therefore the

shell常见命令01

杀马特。学长 韩版系。学妹 提交于 2019-12-01 06:16:26
常用命令01 more 查看文件里的内容 return键:换行 空格键:下一页 b: 后退,上一页 /pattern:查找文档中pattern q:强制退出 ls 展示文件夹内内容 ls:输出文档基本属性 ls -l: 长数据串行出,包含档案的属性等等数据 ls -a:全部的档案,连同隐藏档( 开头为 . 的档案) 一起列出来,隐藏文档以一个点开头 ls -F:根据档案、目录等信息,给予附加数据结构,例如: *:代表可执行档; /:代表目录; =:代表 socket 档案; |:代表 FIFO 档案; ls -R:连同子目录内容一起列出来 ls -Rl:结合了R和l的功能,列出所有目录包括子目录的属性 ls -lFa:组合功能,列出所有文件以及隐藏文件的属性以及附加数据结构 mkdir 命令创建目录 mkdir 目录名:在当前路径下创建目录 mkdir newdir/sub1 newdir/sub2 newdir/sub3:同时创建多个已存在目录的子目录 mkdir -p newdir/sub1:当newdir不存在的时候也能创建 cd 切换当前目录 cd ~/SAN/unixlab1:采用绝对路径的方式切换路径 cd unixlab1:采用相对路径的方式切换路径 cd ..:切换到上一级目录 cd /:切换到根目录 rmdir 删除目录 rmdir newdir

Linux命令(一)

烈酒焚心 提交于 2019-12-01 06:14:17
目录 文件管理 1.cat 2. mv 3. git 4.rm 5.chmod Linux命令(一) 文件管理 1.cat cat 命令用于连接文件并打印到标准输出设备上。 使用权限 所有使用者 语法格式 cat [-AbeEnstTuv] [--help] [--version] fileName 参数说明: -n 或 --number:由 1 开始对所有输出的行数编号。 -b 或 --number-nonblank:和 -n 相似,只不过对于空白行不编号。 -s 或 --squeeze-blank:当遇到有连续两行以上的空白行,就代换为一行的空白行。 -v 或 --show-nonprinting:使用 ^ 和 M- 符号,除了 LFD 和 TAB 之外。 -E 或 --show-ends : 在每行结束处显示 $。 -T 或 --show-tabs: 将 TAB 字符显示为 ^I。 -A, --show-all:等价于 -vET。 -e:等价于"-vE"选项; -t:等价于"-vT"选项; 实例: 把 textfile1 的文档内容加上行号后输入 textfile2 这个文档里: cat -n textfile1 > textfile2 把 textfile1 和 textfile2 的文档内容加上行号(空白行不加)之后将内容附加到 textfile3 文档里: cat -b