From 4c5adb702caef0aebe0d10416521e24e68fa0801 Mon Sep 17 00:00:00 2001 From: Drunkard Zhang Date: Wed, 4 Feb 2015 09:36:51 +0800 Subject: Specify shell while run me as git user Some users disabled "git" user's shell after finished installation, this will lead to "This account is currently not available" and could not run /etc/init.d/gitlab, this dirty trick fix it. Signed-off-by: Drunkard Zhang --- lib/support/init.d/gitlab | 3 ++- lib/support/init.d/gitlab.default.example | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/support/init.d/gitlab b/lib/support/init.d/gitlab index b066a1a6935..946902e2f6d 100755 --- a/lib/support/init.d/gitlab +++ b/lib/support/init.d/gitlab @@ -35,13 +35,14 @@ pid_path="$app_root/tmp/pids" socket_path="$app_root/tmp/sockets" web_server_pid_path="$pid_path/unicorn.pid" sidekiq_pid_path="$pid_path/sidekiq.pid" +shell_path="/bin/bash" # Read configuration variable file if it is present test -f /etc/default/gitlab && . /etc/default/gitlab # Switch to the app_user if it is not he/she who is running the script. if [ "$USER" != "$app_user" ]; then - eval su - "$app_user" -c $(echo \")$0 "$@"$(echo \"); exit; + eval su - "$app_user" -s $shell_path -c $(echo \")$0 "$@"$(echo \"); exit; fi # Switch to the gitlab path, exit on failure. diff --git a/lib/support/init.d/gitlab.default.example b/lib/support/init.d/gitlab.default.example index 9951bacedf5..4c5752766fa 100755 --- a/lib/support/init.d/gitlab.default.example +++ b/lib/support/init.d/gitlab.default.example @@ -29,3 +29,9 @@ web_server_pid_path="$pid_path/unicorn.pid" # sidekiq_pid_path defines the path in which to create the pid file for sidekiq # The default is "$pid_path/sidekiq.pid" sidekiq_pid_path="$pid_path/sidekiq.pid" + +# shell_path defines the path of shell for "$app_user" in case you disabled +# shell of "$app_user" by commands like `usermod -s /sbin/nologin $app_user" +# for security decision. +# The default is "/bin/bash" +shell_path="/bin/bash" -- cgit v1.2.1 From ef351f4cf4c2648ba6e5a71dc6d5086b4e45358d Mon Sep 17 00:00:00 2001 From: Drunkard Zhang Date: Mon, 4 May 2015 16:46:16 +0800 Subject: Improve comments for shell_path --- lib/support/init.d/gitlab.default.example | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/support/init.d/gitlab.default.example b/lib/support/init.d/gitlab.default.example index 4c5752766fa..cf7f4198cbf 100755 --- a/lib/support/init.d/gitlab.default.example +++ b/lib/support/init.d/gitlab.default.example @@ -30,8 +30,7 @@ web_server_pid_path="$pid_path/unicorn.pid" # The default is "$pid_path/sidekiq.pid" sidekiq_pid_path="$pid_path/sidekiq.pid" -# shell_path defines the path of shell for "$app_user" in case you disabled -# shell of "$app_user" by commands like `usermod -s /sbin/nologin $app_user" -# for security decision. +# shell_path defines the path of shell for "$app_user" in case you are using +# shell other than "bash" # The default is "/bin/bash" shell_path="/bin/bash" -- cgit v1.2.1