Monday, August 9, 2010

Command to Change owner and group of file or directory

The Command used to change owner and group of file or directory  uses the following :

Change the owner name of the file :

           
  chown    UserName   FileName  

Change the owner name of the file :

           
  chown username DirectoryName  

Change the owner name and group name of the file :

           
  chown   UserName:GroupName   FileName  

Change the owner name and group name of the directory :

           
  chown   UserName:GroupName   DirectoryName  

Example :

If you want to change the group name as : dba and owner name as user1 for the directory name MyDirectory then the command :

           
  chown   user1:dba   MyDirectoryName  

To recursively change the owner of the files or folders of directory :

use -R ,

           
  chown   -R   owner   File/Folder  

Using –v along with –R will list the changes made ,

           
  chown   -Rv   owner   Folder  

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails
Make Money Blogging