diff --git a/debian/changelog b/debian/changelog index c28f7642..6555d457 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,11 @@ byobu (4.32) unreleased; urgency=low * usr/bin/byobu-launcher: LP: #835130 - silence message that some users found noisy + * usr/bin/byobu, usr/bin/byobu-launch, usr/bin/byobu-launcher, + usr/share/man/man1/byobu.1: LP: #835152 + - fix a suite of support issues around launching byobu under sudo, + where files/dirs would be created under the $SUDO_USER's $HOME, + but would be owned by root -- Dustin Kirkland Tue, 23 Aug 2011 23:23:49 -0500 diff --git a/usr/bin/byobu b/usr/bin/byobu index e12e53be..038b46a5 100755 --- a/usr/bin/byobu +++ b/usr/bin/byobu @@ -18,8 +18,19 @@ # along with this program. If not, see . VERSION=4.32 - PKG="byobu" + +# All sorts of things go wrong if you don't own your $HOME dir. +# This happens under sudo, if you don't use the -H option; Byobu will +# create a bunch of files in your $HOME which will be owned by root. +if [ ! -O "$HOME" ]; then + echo "Cannot run $PKG because [$USER] does not own [$HOME]" 1>&2 + if [ -n "$SUDO_USER" ]; then + echo "To run $PKG under sudo, you MUST use 'sudo -H'" 1>&2 + fi + exit 1 +fi + [ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX . "${BYOBU_PREFIX}/lib/${PKG}/.common" diff --git a/usr/bin/byobu-launch b/usr/bin/byobu-launch index a659c960..9882d8f5 100755 --- a/usr/bin/byobu-launch +++ b/usr/bin/byobu-launch @@ -29,7 +29,7 @@ # $HOME/.bashrc: export LC_BYOBU=0 # or edit your sshd_config, ssh_config, and set: # $HOME/.bashrc: export BYOBU_DISABLE=1 -if [ "$BYOBU_SOURCED_PROFILE" != "1" ] && [ "$LC_BYOBU" != "0" ] && [ "$BYOBU_DISABLE" != "1" ]; then +if [ "$BYOBU_SOURCED_PROFILE" != "1" ] && [ "$LC_BYOBU" != "0" ] && [ "$BYOBU_DISABLE" != "1" ] && [ -O "$HOME" ]; then BYOBU_SOURCED_PROFILE=1 PKG="byobu" [ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX diff --git a/usr/bin/byobu-launcher b/usr/bin/byobu-launcher index d7391d16..25416c75 100755 --- a/usr/bin/byobu-launcher +++ b/usr/bin/byobu-launcher @@ -18,26 +18,29 @@ # along with this program. If not, see . PKG="byobu" -[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX -. "${BYOBU_PREFIX}/lib/${PKG}/.common" - -if [ -e "$BYOBU_CONFIG_DIR/disable-autolaunch" ]; then - false -else - case "$TERM" in - *screen*) - # Handle nesting (silence this message, as some users found it noisy?) - # printf "$(gettext 'To launch in a nested session, run: byobu')\n" - true - ;; - dumb) - # Dumb terminal, don't launch - false - ;; - *) - exec $BYOBU_PREFIX/bin/byobu "$@" - ;; - esac +# Bad things happen if you run byobu, but you don't own your $HOME +# ie, rather than "sudo byobu", you must run "sudo -H byobu" +if [ -O "$HOME" ]; then + [ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX + . "${BYOBU_PREFIX}/lib/${PKG}/.common" + if [ -e "$BYOBU_CONFIG_DIR/disable-autolaunch" ]; then + false + else + case "$TERM" in + *screen*) + # Handle nesting (silence this message, as some users found it noisy?) + # printf "$(gettext 'To launch in a nested session, run: byobu')\n" + true + ;; + dumb) + # Dumb terminal, don't launch + false + ;; + *) + exec $BYOBU_PREFIX/bin/byobu "$@" + ;; + esac + fi fi false diff --git a/usr/share/man/man1/byobu.1 b/usr/share/man/man1/byobu.1 index 264d544c..e3eed74c 100644 --- a/usr/share/man/man1/byobu.1 +++ b/usr/share/man/man1/byobu.1 @@ -188,6 +188,8 @@ Users of a non-UTF8 locale (such as cs_CZ charset ISO-8859-2), may need to add " Users who customize their PS1 prompt need to put this setting in \fI~/.bashrc\fP, rather than \fI~/.profile\fP, in order for it to work correctly with Byobu. +If you run \fBbyobu\fP(1) under \fBsudo\fP(8), you \fBmust\fP use the -H option, such that the user's $HOME directory environment variable is set properly. Otherwise, \fBbyobu\fP(1) will create a bunch of directories in the $SUDO_USER's $HOME, but will be owned by root. To prevent this from happening, \fBbyobu\fP(1) will simply refuse to run if $USER does not own $HOME. + .SH SEE ALSO .PD 0 .TP