This script provides simple project management on Linux systems. It's capable of managing directories and groups on a shared system where ACLs may be either unsupported or too complex for users.
Additionally, it has a helper that can be added to a .bashrc
file to change to a project directory and activate any virtual environments.
Here's the help text for version 1.0:
Usage:
project [action [project [user]]]
Actions:
bashrc - exports source-able script for bashrc (see note in Misc)
create - create a new project
delete - delete a project
fixperms - resets the ownership & permissions of a project's files
help - see this help text
paths - see the project's location
users - see the users in a project
useradd - adds a user to a project
userrm - removed a user from a project
Examples:
project create foo
project useradd foo alice
project userrm foo bob
project fixperms foo
project delete foo
Misc:
System umask should be set to 007 for projects to work best.
Add this to users' .bashrc for convience:
source $(project bashrc)
The .bashrc also enables the command \"proj <project>\" to easily change
to a project's directory, set the umask, and open a venv if it's found
NOTE: Some actions, such as creating/deleting projects and adding/removing users to projects, require
sudo
permissions.
If you have sudo
access and only want to install this script for yourself, place the project
file in the PATH
entry within your home directory, likely at ~/.local/bin/project
In one command (without sudo
):
curl -o ~/.local/bin/project https://raw.githubusercontent.com/ct-martin/project.sh/main/project
To add the proj
command for your use, add the following to your ~/.bashrc
source $(project bashrc)
Place the project
file somewhere in the system's PATH
, for example, /usr/local/bin/project
The recommended ownership is root:root
and permissions are 0711
- this allows users to only be able to execute the script.
Here are some commands to do this:
sudo curl -o /usr/local/bin/project https://raw.githubusercontent.com/ct-martin/project.sh/main/project
sudo chown root:root /usr/local/bin/project
sudo chmod 0711
6506
/usr/local/bin/project
To add the proj
command for all users, add the following to /etc/bash.bashrc
source $(project bashrc)
NOTE: this will add a short MOTD-like message when a user logs in. Submit a feature request via the GitHub Issues if you'd
If the only people who will be able to manage projects already have sudo
access, no extra changes are needed.
If you want to allow some people to manage projects without giving them full sudo
access, you can add an entry to the sudoers
file.
NOTE: Anyone who has sudo access to the project script will be able to modify all projects
For example, this line will allow users in the project-managers
group to manage projects without allowing them to use other commands:
%project-managers ALL=(ALL) /usr/local/bin/project
NOTE: Use
visudo
or similar when editing anysudoers
files to prevent accidentally breaking sudo access
NOTE: the DATA_ROOT must not be under the PROJECTS_ROOT This contraint is to prevent collisions while allowing data to be stored in a different location, for example, to assist in version control of project files or to enable different quotas or backup policies on project files vs data. These additional configurations are not managed by this script.
BASHRC_MOTD
(values0
or1
) - Show the "Useproj <project>
to open a project" message when the user opens a terminalPROJECTS_ROOT
(string) - Directory for all project files (no trailing slash)DATA_ROOT
(string) - Directory for all data files (no trailing slash)GROUP_PREFIX
(string) - Prefix for group names; will be concatenated to project name with a hyphen (e.g., a value of "projects" with project "foo" will become a group called "projects-foo")
NOTE: changes to the
PROJECTS_ROOT
,DATA_ROOT
, andGROUP_PREFIX
after projects have been created will NOT update existing projects; those directories and groups will need to be updated manually
Thank you to my team lead at the School of Information at the University of Texas at Austin for allowing me to open-source this script.