Skip to content

Commit

Permalink
enter: fix regression in login for initful container, Fix #1428
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Di Maio <[email protected]>
  • Loading branch information
89luca89 committed Jun 19, 2024
1 parent 5a837a7 commit bb1a97d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions distrobox-enter
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,12 @@ generate_enter_command()
container_command="$(echo "${container_command}" | sed 's/\$/\\\$/g')"
container_command="${container_command_login} -c \"${container_command}\""
fi

# in case we don't have any command to launch, ensure we do a proper login with su
# we're using here the --shell option in order to execute a POSIX shell for the getent
# command, and then launch whichever shell the user has by default.
# This ensures a proper login also with non-posix shells like fish.
container_command_login="${container_command_login} -s /bin/sh -c \"\\\$(getent passwd ${USER} | cut -f 7 -d :) -l\""
else
result_command="${result_command}
--user=\"${USER}\""
Expand Down

0 comments on commit bb1a97d

Please sign in to comment.