系统为ubuntu12,/var/www/ 目录的权限为:
drwxrwxr-x 3 root root 4096 Dec 24 01:35 www
为什么在www目录下创建文件或文件夹,都提示没权限啊,每次必须sudo才行,怎么解决
高洛峰2017-04-22 09:01:01
drwxrwxr-x
,从左到右第一个字母表示文件系统对象的类别,这里d
Represented as a directory (folder). Other file system objects:
-
(常规文件)、d
(目录)、l
(符号链接)、c
(字符特殊设备)、b
(模块特殊设备)、p
(FIFO)、s
(socket)
drwxrwxr-x
除出去第一个字母d
后的rwxrwxr-x
表示的是三种用户关系对文件或文件夹的操作权限。从左到右每三个一组,依次表示所有者权限、组权限、其他用户权限。每组的顺序均为rwx
,如果用户有相应的操作权限就用相应的字母表示,如果不具有相应的操作权限就用-
表示。比如: rwxrwxr-x
表示文件或文件夹的所有者具有rwx
(可读,可写,可执行)的操作权限,组用户也具有rwx
(可读,可写,可执行)的权限,其他用户具有r-x
(readable, executable, no readable) operation permissions.
So the owner and group of the folder can be modified through sudo chmod 777 -R /var/www/
修改其他用户操作权限或者sudo chown -R ubuntu:adm /var/www/
.
Why777
? You can refer to understand the operation permissions of Linux files and folders
大家讲道理2017-04-22 09:01:01
Your folder is root. Choose one of the three commands chmod, chgrp, and chown to learn about it. Just use one.
巴扎黑2017-04-22 09:01:01
Your permissions here are missing the w permission. You can chmod 777 this directory and add write permissions.
In ubuntu, your user is not root. This directory belongs to the root user, so your permissions are the last one. r-x does not have w permissions.