Pages

Monday, March 3, 2014

chown Command on centos


How do I use chmod and chown command under Linux / Unix operating systems?

Use the chown command to change file owner and group information.
Use the chmod command to change file access permissions such as read, write, and access.


chown command changes the user and/or group ownership of for given file.
The syntax is:

chown [owner user] [file]
or
chown [owner-user]:[owner-group] [file]
or
chown [owner-user]:[owner-group] [directory]


Examples :
we have a file document.txt at directory home/kusdi

#ls -l
sample output :
#-rwxrwxr-x 1 root root 0 Aug 31 05:48 document.txt

and then , we will change user and group ownership to user "kusdi" and group "system"

#chmod kusdi:system document.txt
#ls -l

output :
#-rwxrwxr-x 1 kusdi system 0 Aug 31 05:48 document.txt




No comments:

Post a Comment