The liunx command chown is used to change the object owner to a specified user or group.

Source: Internet
Author: User
The liunx command chown is used to change the owner of a specified file to the specified user or group chown. the user can be a user name or user ID; A group can be a group name or group ID. files are separated by spaces to change the permission list. wildcards are supported. System... the liunx command chown is used to change the owner of a specified file to the specified user or group chown. the user can be a user name or user ID; A group can be a group name or group ID. files are separated by spaces to change the permission list. wildcards are supported. The system administrator often uses the chown command to grant the user the permission to use the file after copying the file to another user's directory. 1. command format: chown [option]... [owner] [: [group] file... 2. command function: use chown to change the owner and Group of the file. When changing the file owner or group, you can use the user name and user ID settings. Normal users cannot change their files to other owners. The operation permission is generally administrator. 3. command parameters: Required parameters: -c: Display the changed information.-f: ignore the error information.-h: fix the symbolic link.-R: process the specified directory and all files in its subdirectories.-v: Display detailed processing information.-deference applies point of the symbolic link, instead of selecting the parameter for the link file itself: -- reference = <目录或文件> Use the specified directory/file as a reference, and set the operated file/directory to the same owner and Group of the reference file/directory -- from = <当前用户:当前群组> Only when the current user and group are the same as the specified user and group -- help display help information -- version display version information 4. use instance: instance 1: Change owner and group command: chown mail: mail log2012.log output: [root @ localhost test6] # ll --- xr -- r -- 1 root users 302108 11-30 linklog. log --- xr -- r -- 1 root users 302108 11-30 log2012.log-rw-r -- 1 root users 61 11-30 08:39 log2013.log-rw-r -- 1 root users 0 11-30 08:39 log2014.log-rw-r -- 1 root users 0 11-30 08:39 log2015.log-rw-r -- 1 root users 0 11-30 08:39 log2016.log- rw-r -- 1 root users 0 11-30 08:39 log2017.log [root @ localhost test6] # chown mail: mail log2012.log [root @ localhost test6] # ll --- xr -- r -- 1 root users 302108 11-30 linklog. log --- xr -- r -- 1 mail 302108 11-30 08:39 log2012.log-rw-r -- 1 root users 61 11-30 08:39 log2013.log-rw-r -- 1 root users 0 11-30 08:39 log2014.log-rw-r -- 1 root users 0 11-30 08:39 log2015.log-rw-r -- 1 root users 0 11-30 08:39 log2016.log- rw-r -- 1 root users 0 11-30 08:39 log2017.log [root @ localhost test6] #

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.