--- tags: [permissions, Linux] created: Friday, April 11, 2025 --- # chown Change the owner of system files and directories. Basic syntax: `chown filename`. ```sh # Change file owner chown user1 doc.txt # Change owner and group chown user1:developers document.txt # Change only the group chown :staff shared_folder/ # Do so recursively for dirs chown -R www-data:www-data /var/www/ ``` TODO: Partition into separate entry on groups: > When a user account in Linux is created the system also creates a group with > the same name as the user (known as the _primary group_ or _user private > group_). Because of the above, you will often change owndership to yourself with: ```sh chown thomas:thomas some_dir ``` See groups: ```sh groups # thomas realtime docker input wheel adb plugdev ``` When reassigning users and groups, it's safest to use the actual name. But each user/group also has a numeric representation, corresponding to UID:GID. The first regular, non-system user created on most Unix distributions is 1000 but this isn't universal. Likewise his group will be 1000. See your UID/GID and the GIDs of the groups you're in: ``` $ id uid=1000(thomas) gid=1000(thomas) groups=1000(thomas),959(realtime),966(docker),994(input),998(wheel),1001(adb),1002(plugdev) ```