File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -177,9 +177,14 @@ else
177
177
echo " There is no entry in /etc/passwd for our UID. Attempting to fix..."
178
178
if [[ -w /etc/passwd ]]; then
179
179
echo " Renaming old jovyan user to nayvoj ($( id -u jovyan) :$( id -g jovyan) )"
180
- sed --in-place " s/^jovyan:/nayvoj:/" /etc/passwd
181
180
182
- echo " jovyan:x:$( id -u) :$( id -g) :,,,:/home/jovyan:/bin/bash" >> /etc/passwd
181
+ # We cannot use "sed --in-place" since sed tries to create a temp file in
182
+ # /etc/ and we may not have write access. Apply sed on our own temp file:
183
+ sed --expression=" s/^jovyan:/nayvoj:/" /etc/passwd > /tmp/passwd
184
+ echo " jovyan:x:$( id -u) :$( id -g) :,,,:/home/jovyan:/bin/bash" >> /tmp/passwd
185
+ cat /tmp/passwd > /etc/passwd
186
+ rm /tmp/passwd
187
+
183
188
echo " Added new jovyan user ($( id -u) :$( id -g) ). Fixed UID!"
184
189
else
185
190
echo " WARNING: unable to fix missing /etc/passwd entry because we don't have write permission."
You can’t perform that action at this time.
0 commit comments