-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix home directory ownership (#1011)
Fixes kairos-io/kairos#2797 Signed-off-by: Dimitris Karakasilis <[email protected]>
- Loading branch information
1 parent
1c02ec8
commit 6c61ee8
Showing
2 changed files
with
16 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
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" |
15 changes: 15 additions & 0 deletions
15
packages/static/kairos-overlay-files/files/system/oem/00_home_dir_owner_fix.yaml
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,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 |