Skip to content

Commit

Permalink
Fix home directory ownership (#1011)
Browse files Browse the repository at this point in the history
Fixes kairos-io/kairos#2797

Signed-off-by: Dimitris Karakasilis <[email protected]>
  • Loading branch information
jimmykarily authored Aug 26, 2024
1 parent 1c02ec8 commit 6c61ee8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/static/kairos-overlay-files/collection.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
packages:
- name: "kairos-overlay-files"
category: "static"
version: "1.1.45"
version: "1.1.46"
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Fix home directory permissions (kairos issue #2797)"
stages:
initramfs.after:
- name: "Fix permissions"
commands:
- |
# Iterate over users in /etc/passwd and chown their directories
awk -F: '$3 >= 1000 && $6 ~ /^\/home\// {print $1, $6}' /etc/passwd | while read -r user homedir; do
if [ -d "$homedir" ]; then # Check if the home directory exists
echo "Changing ownership of $homedir to $user"
chown -R "$user":"$user" "$homedir"
else
echo "Directory $homedir does not exist for user $user"
fi
done

0 comments on commit 6c61ee8

Please sign in to comment.