[PATCH] bug fix: "sudo: sorry, you must have a tty to run sudo".

The authorization code executes some sudo commands in backend to check if the user used to login in Kimchi has permission to execute privileged commands. By default, sudo needs a TTY to be executed and when Kimchi is executed as a service by systemd (systemctl start kimchid.service), it runs disconnected from any TTY, and sudo returns an error and the message: "sudo: sorry, you must have a tty to run sudo". This patch sets in Kimchi service file for systemd the /dev/tty11 as default TTY to execute the service. Signed-off-by: Paulo Vital <pvital@linux.vnet.ibm.com> --- contrib/kimchid.service.fedora | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/kimchid.service.fedora b/contrib/kimchid.service.fedora index 7abe49b..5f274fb 100644 --- a/contrib/kimchid.service.fedora +++ b/contrib/kimchid.service.fedora @@ -8,6 +8,9 @@ Type=simple ExecStart=/usr/bin/kimchid ExecStop=/bin/kill -TERM $MAINPID EnvironmentFile=/etc/kimchi/kimchi.conf +StandardInput=tty +StandardOutput=tty +TTYPath=/dev/tty11 [Install] WantedBy=multi-user.target -- 1.8.3.1

Reviewed-by: Aline Manera <alinefm@linux.vnet.ibm.com> Just more information: sudo requires TTY only on RHEL/Fedora distros by default. On 03/07/2014 01:45 PM, Paulo Vital wrote:
The authorization code executes some sudo commands in backend to check if the user used to login in Kimchi has permission to execute privileged commands.
By default, sudo needs a TTY to be executed and when Kimchi is executed as a service by systemd (systemctl start kimchid.service), it runs disconnected from any TTY, and sudo returns an error and the message: "sudo: sorry, you must have a tty to run sudo".
This patch sets in Kimchi service file for systemd the /dev/tty11 as default TTY to execute the service.
Signed-off-by: Paulo Vital <pvital@linux.vnet.ibm.com> --- contrib/kimchid.service.fedora | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/contrib/kimchid.service.fedora b/contrib/kimchid.service.fedora index 7abe49b..5f274fb 100644 --- a/contrib/kimchid.service.fedora +++ b/contrib/kimchid.service.fedora @@ -8,6 +8,9 @@ Type=simple ExecStart=/usr/bin/kimchid ExecStop=/bin/kill -TERM $MAINPID EnvironmentFile=/etc/kimchi/kimchi.conf +StandardInput=tty +StandardOutput=tty +TTYPath=/dev/tty11
[Install] WantedBy=multi-user.target

Applied. Thanks. Regards, Aline Manera
participants (2)
-
Aline Manera
-
Paulo Vital