-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #199 from nmfs-opensci/eeholmes-patch-2
fix home/jovyan permissions
- Loading branch information
Showing
3 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
# Required User: root | ||
|
||
echo "Running fix-home-permissions.sh" | ||
|
||
# Check if the script is run as root | ||
if [[ $(id -u) -ne 0 ]]; then | ||
echo "Error: fix-home-permissions.sh must be run as root. Please use 'USER root' in your Dockerfile before running this script." | ||
echo "Remember to switch back to the non-root user with 'USER ${NB_USER}' after running this script." | ||
exit 1 | ||
fi | ||
|
||
echo "Running fix-home-permissions.sh as $(whoami)..." | ||
|
||
# Define the target directory | ||
TARGET_DIR="/home/${NB_USER}" | ||
|
||
# Change ownership only for items not owned by ${NB_USER} | ||
sudo find "${TARGET_DIR}" ! -user "${NB_USER}" -exec chown "${NB_USER}:${NB_USER}" {} \; | ||
|
||
# Set permissions on all directories: read, write, and execute for ${NB_USER} | ||
sudo find "${TARGET_DIR}" -type d -exec chmod 755 {} \; | ||
|
||
# Set permissions on all files: read and write for ${NB_USER} | ||
sudo find "${TARGET_DIR}" -type f -exec chmod 644 {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters