* 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
This commit is contained in:
Dustin Kirkland 2011-08-26 18:58:16 -05:00
commit 75ee3f7480
5 changed files with 43 additions and 22 deletions

5
debian/changelog vendored
View file

@ -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 <kirkland@ubuntu.com> Tue, 23 Aug 2011 23:23:49 -0500

View file

@ -18,8 +18,19 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
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"

View file

@ -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

View file

@ -18,9 +18,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="byobu"
# 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
@ -39,6 +41,7 @@ else
;;
esac
fi
fi
false
# vi: syntax=sh ts=4 noexpandtab

View file

@ -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