ubuntu - 如何在linux下对文件夹进行权限设置,使其他用户可以在文件夹内添加文件,但是不能删除文件
天蓬老师
天蓬老师 2017-04-17 13:47:28
0
3
725

A用户创建文件夹share,B用户可以在文件夹下新增文件(不可以创建文件夹),同时不能删除share中的任何文件。

权限有读、写、执行,这三项,是如何对应创建文件、写入文件、删除文件等……操作的呢?

添加文件和删除文件都需要写操作,貌似不能区分开?

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(3)
Peter_Zhu

rwx For folders
r means you can read the file structure of the directory. You can use ls to view the file structure under the folder.
w means you can create, create, and edit files in the directory. Delete and rename
x means you can use the cd command to switch to this directory

阿神

You can use the chmod command to set file permissions

Command name: chmod
 
Usage permissions: All users
 
Usage method: chmod [-cfvR] [–help] [–version] mode file…
 
Note: Linux/Unix file access permissions are divided into three levels: file owner, group, and others. Use chmod to control how files are accessed by others.
 
 Parameters:
 
 mode: Permission setting string, the format is as follows: ugoa…rwxX]…, where
u represents the owner of the file, g represents the ownership of the file Those who belong to the same group (group), o means people other than others, and a means all three.
+ means adding permissions, - means canceling permissions, = means setting only permissions.
 r means readable, w means writable, x means executable, and X means only when the file is a subdirectory or the file has been set to be executable.
-c: If the file permissions have indeed been changed, only display the change action
-f: If the file permissions cannot be changed, do not display an error message
-v: Display the details of the permission changes
-R: Make the same permission changes to all files and subdirectories in the current directory (that is, change them one by one in a recursive manner)
–help: Display auxiliary instructions
–version: Display version

PHPzhong
chmod o+t /tmp
su -c 'mkdir /tmp/share' user1

# In this way, only user1 and root users can delete the share directory, other users cannot delete it

As far as I know, it seems that the function of creating files but not creating directories is not possible

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template