chown in Mac OS X

By: Strauss K Emailed: 1643 times Printed: 2122 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

Change file owner and/or group.

Syntax 
      chown [-fhv] [-R [-H | -L | -P]] owner[:group] file ...

      chown [-fhv] [-R [-H | -L | -P]] :group file ...

Options

   -R         Recurse: Change the mode of file hierarchies rooted in the files
              instead of just the files themselves.

   -R -H      Follow symbolic links on the command line
              (by default Symbolic links within the tree are not followed.)	       
   -R -L      All symbolic links are followed.
   -R -P      No symbolic links are followed. (default)
	     
   -f         Do not display a diagnostic message if chmod could not modify the
              mode for file.

   -h         If the file is a symbolic link, change the mode of the link
              itself rather than the file that the link points to.

   -v         Verbose, show filenames as the mode is modified*

The owner and group operands are both optional; however, at least one must be specified. If the group operand is specified, it must be preceded by a colon (:) character.

* The -v option is non-standard and its use in scripts is not recommended.

The ownership of a file may only be altered by a super-user for obvious security reasons.

Notes

Previous versions of the chown utility used the dot (.) character to distinguish the group name. This has been changed to be a colon (:) character so that user and group names may contain the dot character.

The -v option is non-standard and its use in scripts is not recommended.

The owner/group may be either a numeric ID or a name. If a user/group name is also a numeric user ID, the operand is used as a user name.

chown exits 0 on success, and >0 if an error occurs.

Examples

Assign Ursula as the owner of "MyFile.txt" file in the Shared directory.

$ sudo chown Ursula /Users/Shared/MyFile.txt

Assign Ursula as the owner, and staff as the group for everything in the "tmp" folder

$ sudo chown -R Ursula:staff /Users/Shared/tmp/


macos Home | All macos Tutorials | Latest macos Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(0)


Be the first one to add a comment

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Strauss K
cut in Mac OS X
curl in Mac OS X
crontab in Mac OS X
cron in Mac OS X
cp in Mac OS X
continue in Mac OS X
complete in Mac OS X
command in Mac OS X
comm in Mac OS X
cmp in Mac OS X
cksum in Mac OS X
chroot in Mac OS X
chown in Mac OS X
chmod in Mac OS X
chgrp in Mac OS X

More Tutorials in macos
Getting PHP running on Mac OS 10.1
Installing gedit for python programming in Mac OS X
What is Mac OS X?
History of Mac OS X
Major features of Mac OS X
Different Versions of Mac OS X
What is new in Mac OS X Snow Leopard
alias, unalias in Mac OS X
apropos in Mac OS X
awk in Mac OS X
basename in Mac OS X
bash in Mac OS X
bg in Mac OS X
bless in Mac OS X
break in Mac OS X

More Latest News
Most Viewed Articles (in macos )
Different Versions of Mac OS X
What is Mac OS X?
awk in Mac OS X
bg in Mac OS X
bless in Mac OS X
chflags in Mac OS X
chmod in Mac OS X
chown in Mac OS X
Installing gedit for python programming in Mac OS X
History of Mac OS X
Major features of Mac OS X
What is new in Mac OS X Snow Leopard
alias, unalias in Mac OS X
apropos in Mac OS X
basename in Mac OS X
Most Emailed Articles (in macos)
Installing gedit for python programming in Mac OS X
What is new in Mac OS X Snow Leopard
awk in Mac OS X
basename in Mac OS X
apropos in Mac OS X
chmod in Mac OS X
cp in Mac OS X
curl in Mac OS X
cut in Mac OS X
bash in Mac OS X
cd in Mac OS X
chflags in Mac OS X
cksum in Mac OS X
complete in Mac OS X
Getting PHP running on Mac OS 10.1