chmod

linux 文件目录权限

廉价感情. 提交于 2019-12-03 05:12:47
文件目录权限: 什么是文件权限: 在Linux中,每个文件都有所属的所有者,和所有组,并且规定了文件的所有者,所有组以及其他人对文件的,可读,可写,可执行等权限。 对于目录的权限来说,可读是读取目录文件列表,可写是表示在目录内新增,修改,删除文件。可执行表示可以进入目录 Linux权限的目的是(保护账户的资料) Linux权限主要依据三种身份来决定: user/owner -------- 文件使用者,文件属于哪个用户 group ---------- 属组,文件属于哪个组 others ---------- 既不是user,也不再group,就是other,其他人 linux权限的查看 ls -l /var/log/mysqld.log 1. 权限: 第一个字母为文件类型,后续9个字母,每3个一组,是三种身份的组合 2. 属主: 当前这个文件的拥有者 3. 属组: 也是文件的拥有者 4. 时间是最后一次修改文件的时间 # 文件类型 - 一般文件 d 文件夹 l 软连接(快捷方式) b 块设备,存储媒体文件为主 c 代表键盘,鼠标等设备 文件的权限: r read可读,可以用cat等命令查看 w write写入,可以编辑或者删除这个文件 x executable 可以执行 目录权限 r 可以对此目录执行ls列出所有文件 w 可以在这个目录创建文件 x 可以cd进入这个目录

创建用户

元气小坏坏 提交于 2019-12-03 04:28:27
查看用户 1 whoami #要查看当前登录用户的用户名 2 who am i #表示打开当前伪终端的用户的用户名 3 who mom likes who 命令其它常用参数 1 参数 说明 2 -a 打印能打印的全部 3 -d 打印死掉的进程 4 -m 同am i,mom likes 5 -q 打印当前登录用户数及用户名 6 -u 打印当前登录用户登录信息 7 -r 打印运行等级 1. 创建用户 adduser这个命令,我们很容易理解其作用,因为完全可以顾名思义:add是英语“添加”的意思,user是英语“用户”的意思,因此adduser就是用于添加用户。 1 adduser newname // 新建用户newname useradd 只创建用户,创建完了用 passwd lilei 去设置新用户的密码。 adduser 会创建用户,创建目录,创建密码(提示你设置),做这一系列的操作。 其实 useradd、userdel 这类操作更像是一种命令,执行完了就返回。而 adduser 更像是一种程序,需要你输入、确定等一系列操作 删除用户 deluser是delete和user的缩写,delete是英语“删除”的意思,user是“用户”的意思。 1 userdel newname 单单用deluser命令,不加参数的话,只会删除用户,但是不会删除在/home目录中的用户家目录

Chmod 640 for uploaded file after SUPEE 7405 patch

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: After installing the SUPEE 7405 patch, we noticed a problem uploading images from the admin. All file permissions are being set to CHMOD 640 which makes them inaccessible to all users. Is there a solution that does not involve rewriting the /lib/Varien/File/Uploader.php file? 回答1: A new version of SUPEE-7405 has been released that resolves this issue: http://magento.com/security/patches/supee-7405 Updated February 23, 2016 Updated versions of this release are now available. The updates add support for PHP 5.3 and address issues with upload

Can Ant's recursive chmod compete with exec in terms of speed?

匿名 (未验证) 提交于 2019-12-03 03:05:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to chmod recursively in my build.xml and borrowed the following from this post : <chmod file="${basedir}/foo/**" perm="755" type="both"/> It's unbelievably slow since that directory is deep and includes a large number of files. This works much better & faster: <exec executable="chmod" dir="${basedir}/foo" failonerror="true"> <arg line="-R 0755 ." /> </exec> Are there any downsides of using exec ? Speed is of importance. If yes; am I using chmod incorrectly? 回答1: Exec is faster because the chmod task is gathering all the files and then

How to chmod 0777 a file and commit as is to Git on Windows?

匿名 (未验证) 提交于 2019-12-03 02:50:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm working on Windows and on the production there's a Linux system and I'd like to chmod some files to 0777, but I don't know how to do it on Windows. I rather not do it on production, because I'm unable to commit/push there. Is there a way to chmod 0777 a file on Windows and commit it to Git so that it stays 0777 when I clone/pull on the production? 回答1: If you want to mark the file as executable, you can use git update-index --chmod=+x <your_file> If you really want to have the file writable for everyone, you would have to set up a post

&#039;Failed to open stream: Permission denied&#039; error - Laravel

匿名 (未验证) 提交于 2019-12-03 02:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am new to laravel. I was trying to open http://localhost/test/public/ and I got Error in exception handler. I googled around and changed the permission of storage directory using chmod -R 777 app/storage but to no avail. I changed debug=>true in app.php and visited the page and got Error in exception handler: The stream or file "/var/www/html/test/app/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/html/test/bootstrap/compiled.php:8423 Then I changed the permissions of storage directory

chmod: cannot read directory `.&#039;: Permission denied [closed]

匿名 (未验证) 提交于 2019-12-03 02:46:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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 the execute permission set in order to see their contents. From http://content.hccfl.edu/pollock/AUnix1/FilePermissions.htm You can think of read and execute on directories this way: directories are data files that hold two pieces of

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

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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 . -type d -print0 | xargs -0 chmod 0755 for files find . -type f -print0 | xargs -0 chmod 0644 回答2: The easiest way is to do: chmod -R u+rwX,go+rX,go-w /foo 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 and o ther users: r ead and e X ecute permissions, but not -w rite permission. Please note

Chmod recursively directories only?

匿名 (未验证) 提交于 2019-12-03 02:27:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: It's not work fo me: target_dir = "a/b/c/d/e/" os.makedirs(target_dir,0777) os.chmod work only for last directory ... 回答1: You can use os.walk to traverse directories. (Below not tested, experiment it yourself) for r, d, f in os.walk(path): os.chmod(r, 0o777) 回答2: ghostdog74's answer almost works, but it tries to walk into the directory before it chmods it. So the real answer is less elegant: os.chmod(path , 0o777) for root,dirs,_ in os.walk(path): for d in dirs : os.chmod(os.path.join(root,d) , 0o777) 回答3: One line version for this is: list

chmod failed: EPERM (Operation not permitted) in android?

匿名 (未验证) 提交于 2019-12-03 02:19:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: i want to create database in sdcard or external sdcard for this i have try this code and using this i have successfully created database in sdcard but in logcat it give me warning like below Logcat 07-18 14:18:22.140: W/FileUtils(8595): Failed to chmod(/mnt/sdcard/peakmedia/DB_PMD): libcore.io.ErrnoException: chmod failed: EPERM (Operation not permitted) DB_Helper.java public class DB_Helper extends SQLiteOpenHelper { public DB_Helper(Context context) { super(context, Environment.getExternalStorageDirectory().getAbsolutePath() + File