Home  >  Article  >  System Tutorial  >  Change the folder owner to the current group and set folder permissions

Change the folder owner to the current group and set folder permissions

WBOY
WBOYforward
2024-01-26 17:03:15439browse

It is simpler, although you can directly change the owner of the file to the current group China linux, and then add the folder permissions to use the linux format command, that is:

# 将目录/opt 及其下面的所有文件、子目录的文件主改成 liuhai
chown -R liuhai:liuhai /opt

#给目录opt设置权限
chmod 760 /opt

Note: In liuhai:liuhai, the second one is the group name. If it is not specified when creating a user, the default is users.

For more details, see Linux gives users permissions to operate a certain folder_linux gives permissions to specified user folders_dhq_blog's blog-CSDN blog

linux文件夹授权写权限_linux授权文件夹给用户_linux授权文件给用户

Use user groups to grant users read and write permissions to the specified directory

If the user already has a default user group (generally the group name is the same as the user name) linux authorizes the folder to the user, or already belongs to a user group, you can simply change the file This is done by selecting the user group to which the folder belongs.

#chgrp-Rstorm/usr/local

If you want to rebuild users and user groups and reset permissions, you need to follow the steps below.

linux授权文件给用户_linux授权文件夹给用户_linux文件夹授权写权限

1. Create user

#useraddrestart1025

2. Set password

#passwdrestart1025

3. Create user group

#groupaddstorm

4. Set the user group to which the user belongs

#usermod-aGstormrestart1025#addrestart1025tostorm

linux文件夹授权写权限_linux授权文件给用户_linux授权文件夹给用户

#groupsrestart1025#checkrestart1025groups

5. Change the user group of the directory to storm:

#chgrp-Rstorm/usr/local

6. Set read and write permissions for group members.

#chmod-R0760/usr/local

#ls-l/usr/local/#checknewpermissions

————————————————

The above is the detailed content of Change the folder owner to the current group and set folder permissions. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:itcool.net. If there is any infringement, please contact admin@php.cn delete