====== Change Owner and Group ====== When using a Linux filesystem, every file and directory belongs to an owner and group. Files and directories created by users, normally belong to them. Operating system files and directories often belong to root. Having file ownership makes unauthorized access more difficult, and increases the security of Linux operating systems. There may be times when you want to change the owner and group of files or directories. For example, you may copy files from a USB drive using the root file manager, and they may belong to root. ==== Find Out Owner and Group ==== To find out the owner and group, open the terminal and type: ls -l Some file managers also display the owner and group. ==== Change Owner and Group ==== The owner and group can be changed using the "chown" (change owner) command. Options include chown [option] [owner][:[group]] file [more files] The options within square brackets are optional. ==== Example ==== For example, let's say you copied mylist.txt to /home/tc, and it belongs to root:root. To change the owner and group to tc:staff, open the terminal and type sudo su cd /home/tc chown tc:staff mylist.txt ==== The Recursive Option ==== The recursive option enables you to change the owner and group of a directory, and all files and directories within that directory, with one command. To do this use "-R." For example, let's say you copied the directory myfiles to /home/tc, and it contains other files and directories, belonging to root:root. To change the owner and group of all of these files and directories to tc:staff, open the terminal and type sudo su cd /home/tc chown -R tc:staff myfiles ==== Save Files in Another Linux Partition ==== If you create a directory in another Linux partition to save files in, you may need to create it as root. It will then be owned by root. To save files in it, you then need to be root. If you change the owner and group of the directory to tc:staff, you can save files in it as tc.