myown is a simple yet powerful shell script that ensures you can always keep working on your projects without permission headaches. It aligns the ownership of files and directories to your current user, supporting both regular and recursive operations.
Have you ever been in the middle of debugging a complex project, only to find yourself stuck because some files were mysteriously created with the wrong permissions?
It’s a common issue when working with tools like Docker. Those containers that build your code or process your data leave behind files and directories owned by root
or some other user. Suddenly, your editor complains, your commands fail, and you’re left battling with chown
or sudo
instead of focusing on your code.
It’s frustrating. It’s boring. And it disrupts your flow.
myown is here to save the day. With a single command, you can fix all those permission issues instantly. Forget the frustration and get back to coding and debugging without breaking a sweat.
- Changes the ownership of files and directories to match your current user.
- Supports recursive updates with the
-r
flag. - Automatically uses
sudo
if needed, so you don’t have to worry about permissions. - Provides clear messages for every operation, including success, errors, or missing files.
To install myown, follow these simple steps:
-
Download the script:
curl -o myown https://raw.githubusercontent.com/francescobianco/myown/refs/heads/main/bin/myown
-
Copy the script to
/usr/local/bin
:sudo mv myown /usr/local/bin
-
Make it executable:
sudo chmod +x /usr/local/bin/myown
Now you can run myown
from anywhere on your system.
myown [-r] file1 [file2 ...]
-r
: Apply changes recursively to directories and their contents.
file1 file2 ...
: A list of files or directories to adjust.
Fix ownership of a single file:
myown file.txt
Fix ownership of a directory and its contents:
myown -r myfolder
Fix ownership of multiple files and directories:
myown file1.txt file2.txt myfolder
- The script reads the owner and group of your home directory (
$HOME
) to determine the default ownership. - It processes the provided files and directories:
- Applies
chown
to set the correct ownership. - Automatically invokes
sudo
if elevated privileges are required.
- Applies
- For each file or directory, it provides feedback:
- Success messages for updated permissions.
- Warnings for non-existent files or directories.
- Error messages if something goes wrong.
When you’re deep into debugging or developing, permission issues can derail your workflow. myown was designed to quickly fix these problems, so you can focus on what truly matters: your code.
This script is particularly useful in Docker-based workflows, where files created by containers often have mismatched permissions. Instead of losing precious time troubleshooting, just run myown
to seamlessly realign your project’s file ownership and get back to work.
- A Unix/Linux environment with support for
chown
. sudo
privileges for modifying files you don’t own.
Be cautious when using the -r
flag on large directories to avoid unintended changes.
Created out of necessity by a developer frustrated with permission issues in modern workflows, myown is here to make your life easier. Give it a try, and never let permission problems interrupt your development again.
This project is licensed under the MIT License - see the LICENSE file for details.