{"id":23642647,"url":"https://github.com/kotfu/chogm","last_synced_at":"2025-08-31T19:30:46.666Z","repository":{"id":6187765,"uuid":"7418184","full_name":"kotfu/chogm","owner":"kotfu","description":"Change the owner, group and mode of both files and directories with one command","archived":false,"fork":false,"pushed_at":"2020-08-25T21:23:19.000Z","size":20,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2023-04-05T09:10:44.876Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kotfu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-03T05:33:47.000Z","updated_at":"2020-06-03T04:58:11.000Z","dependencies_parsed_at":"2022-09-04T01:12:06.413Z","dependency_job_id":null,"html_url":"https://github.com/kotfu/chogm","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kotfu%2Fchogm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kotfu%2Fchogm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kotfu%2Fchogm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kotfu%2Fchogm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kotfu","download_url":"https://codeload.github.com/kotfu/chogm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231615472,"owners_count":18400983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-28T10:51:54.848Z","updated_at":"2024-12-28T10:51:55.516Z","avatar_url":"https://github.com/kotfu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"chogm\n-----\n\nChange the owner, group and mode of some files with a single command\n\nUsage\n-----\n\n    chogm [OPTIONS] files_spec directories_spec file [file file ...]  \n       -R, --recursive      recurse through the directory tree of each file  \n       -v, --verbose        show progress  \n       -h, --help           display this usage message  \n       file_spec           owner:group:perms to set on files  \n       directory_spec     owner:group:perms to set on directories  \n       file                 one or more files to operate on.  Use '-' to  \n                            process stdin as a list of files  \n\n    file_spec tells what owner, group, and permissions should be given to any\n    files. Each of the three elements are separated by a ':'. If a value is\n    not given for a particular element, that that element is not changed on\n    the encountered files.\n\n    directory_spec works just like files_spec, but it is applied to\n    directories. If any element of directory_spec is a comma, the value of that\n    element will be used from file_spec\n\n\nExamples\n--------\n\n### Simple\n\n    chogm www-data:www-data:644 -:-:755 /pub/www/*\n\nChange all files in /pub/www to have an owner and group of www-data, and\npermissions of -rw-r--r--. Also change all directories in /pub/www/ to\nhave an owner and group of www-data, but permissions of -rwxr-xr-x. This\nis equivilent to the following shell commands:\n\n    $ chown www-data:www-group /pub/www/*\n    $ find /pub/www -maxdepth 1 -type f | xargs chmod 644\n    $ find /pub/www -maxdepth 1 -type d | tail -n +2 | xargs chmod 755 \n\n### More Complex\n\n    chogm -R :accounting:g+rw,o= :-:g=rwx,o= /mnt/acct\n\nChange the group of all files in /mnt/acct to be accounting, and make\nsure people in that group can read, write, and create files anywhere in\nthat directory tree. Also make sure that the hoi palloi can't peek at\naccounting's files. This is the same as doing:\n\n    $ chgrp -R accounting /mnt/acct\n    $ find /mnt/acct -type f -print | xargs chmod g+rw,o=\n    $ find /mnt/acct -type d -print | xargs chmod g=rwx,o= \n\n### Using stdin\n\n    find ~/src -depth 2 -type d -print | grep -v '/.git$' | chogm -R :staff:660 :-:770 -\n\nAssuming your ~/src directory contains a bunch of directories, each with\ntheir own git project, change all those files to have a group of staff\nand permissions of -rw-rw---- and all the directories to also have a\ngroup of staff but permissions of -rwxrwx---. While doing all of that,\ndon't change the permissions of any of the files inside of .git\ndirectories.\n\n\nRequirements\n------------\n\nThis script uses the operating system commands xargs, chmod, chgrp, and\nchmod to do it's work. It also uses the python multiprocessing module from\nthe standard library which was added in python 2.6, so it won't work with\npython versions earlier than that. It works in python 2.7 and 3+.\n\nExit Status\n-----------\n\n 0 - everything OK  \n 1 - some operations not successful (ie permission denied on a directory)  \n 2 - incorrect usage\n\n\nLicense\n-------\n\nCheck the LICENSE file.  It's the MIT License, which means you can do whatever you want, as long as you keep the copyright notice.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkotfu%2Fchogm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkotfu%2Fchogm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkotfu%2Fchogm/lists"}