Package: cloud.debian.org
Severity: normal

Dear Maintainer,

Vagrant base box debian/stretch64 (and debian/jessie64) includes a home
directory /home/vagrant containing only the .ssh directory: none of .bashrc,
.profile and .bash_logout are present (i.e. files normally copied from
/etc/skel). This makes the Vagrant user behaviour slightly different than
expected, and makes e.g. custom .bashrc not run without adding a .profile.

The included patch for debian-vm-templates fixes it by having useradd make the
home directory, using the default skeleton directory files.


From 68de99c4cf2114bfdde0077ff4afea6a52c33f40 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Mas=C5=82owski?= <m.maslow...@clearcode.cc>
Date: Fri, 22 Sep 2017 16:26:58 +0200
Subject: [PATCH] helpers/vagrant-setup: make useradd create the vagrant user
 home directory

It populates the home directory with files from /etc/skel, so e.g. .bashrc is
available and is loaded when logging in.
---
 helpers/vagrant-setup | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/helpers/vagrant-setup b/helpers/vagrant-setup
index 7f8af9f..2754d41 100755
--- a/helpers/vagrant-setup
+++ b/helpers/vagrant-setup
@@ -41,9 +41,7 @@ chroot $fs apt-get purge -qy dctrl-tools
 # setup vagrant user
 #######################################################################
 chroot $fs id ubuntu >/dev/null 2>&1 && chroot $fs deluser ubuntu
-chroot $fs id vagrant >/dev/null 2>&1 || chroot $fs useradd --uid 1000 --shell 
/bin/bash vagrant
-mkdir -p $fs/home/vagrant
-chroot $fs chown vagrant:vagrant /home/vagrant
+chroot $fs id vagrant >/dev/null 2>&1 || chroot $fs useradd --create-home 
--uid 1000 --shell /bin/bash vagrant
 mkdir -p $fs/home/vagrant/.ssh
 chmod 700 $fs/home/vagrant/.ssh
 cat > $fs/home/vagrant/.ssh/authorized_keys << EOF
--
2.11.0



-- System Information:
Debian Release: 9.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Reply via email to