What is file and folder ownership? In Linux file permissions, “ownership” means that the owner, whether the owning user or the owning group, has full control over the file or folder. Basically, every file and folder on a Linux system can be accessed by three different groups of users – the owning user, the owning group, and everybody else with an account on the system. The owning user and group, obviously, are the particular user and group that have been assigned ownership of that file or folder. (The owner and the root user are the only ones who can change or assign permissions to a file.) Everyone else means every other user on the system.
Permissions are then assigned based on those groups – the owning user, the owning group, and all other users on the system.
Assigning permissions is useful, but it’s only the first half of managing security for your files and folders. You may also need to sometimes take ownership of files, or to assign them to different owners. Or you may need to assign a file to a different group.
To change the ownership of files, you can use the chown command. To assign the ownership of the test.txt file to a user named tim:
sudo chown tim test.txt
(You won’t need root permissions to change the ownership of files you already own, but you’ll need it while changing the ownership of files that you don’t own.)
You might have noticed that all this command only affects one file or directory at one time. How do you change the ownership of a large number of files at once? Like the cp or the mv commands, all the commands for managing permissions and ownership work with both the recursive -r option and with wildcards. For instance, to assign ownership of the /test directory, and all its files and sub-directories, to a user named tim:
sudo chown -r tim /test
Using chown, you can quickly manage both ownership on your Linux system.
Incoming search terms:
- chown ubuntu (9)
- ubuntu 11 10 how to take ownership of folder (7)
- how to change permissions of all the folders within a folder in ubuntu 11 10 (6)
- take ownership ubuntu (3)
- how to take ownership of all files ubuntu 11 10 (3)
- how to change permission using terminal in ubuntu 11 10 (2)
- fedora take ownership folder (2)
- chown command centos 6 2 (2)
- ubuntu directory ownership (2)
- change ownership command ubuntu (2)