Skip to content

Commit

Permalink
ignore files in other filesystems when changing user id
Browse files Browse the repository at this point in the history
  • Loading branch information
cezarsa committed Aug 21, 2017
1 parent 696187e commit 8c757e4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ usermod -u {{.newUID}} {{.username}};
groupmod -g {{.newUID}} {{.username}};
useradd -M -U -u {{.oldUID}} {{.oldUserPrefix}}{{.username}};
echo "{{.oldUserPrefix}}{{.username}} ALL=(#{{.newUID}}) NOPASSWD:ALL" >>/etc/sudoers;
find / \( -name proc -o -name dev -o -name sys \) -prune -o \( -user {{.oldUID}} -exec chown -h {{.newUID}}:{{.newUID}} {} + \);
find / -mount -user {{.oldUID}} -exec chown -h {{.newUID}}:{{.newUID}} {} +;
`)
}

Expand Down
2 changes: 1 addition & 1 deletion internal/user/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ usermod -u 1234 .+?;
groupmod -g 1234 .+?;
useradd -M -U -u \d+ tsuru\.old\..+?;
echo "tsuru\.old\..+? ALL=\(#1234\) NOPASSWD:ALL" >>/etc/sudoers;
find / \\\( -name proc -o -name dev -o -name sys \\\) -prune -o \\\( -user \d+ -exec chown -h 1234:1234 \{\} \+ \\\);
find / -mount -user \d+ -exec chown -h 1234:1234 \{\} \+;
`)
}

Expand Down

0 comments on commit 8c757e4

Please sign in to comment.