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. 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 = <directory or File>, the specified directory/file is used as a reference, set the operation file/directory to the reference file/directory with the same owner and group -- from = <Current User: current group> changes are made only when the current user and group are the same as the specified user and group -- help displays help information -- version displays 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.