diff --git a/files/user_setup b/files/user_setup index 0775774..bcc06ab 100755 --- a/files/user_setup +++ b/files/user_setup @@ -81,8 +81,13 @@ function trim_extra_slashes { # Adds/Deletes user function user_do { # Add the user - adduser --disabled-password --gecos "" "$@" >/dev/null + adduser --disabled-password --no-create-home --gecos "" "$@" >/dev/null e_catch $? "Add user '$USER_NAME'" + # Set permissions for the home folder since it's not owned by the new user + # due to having been created by Vagrant as a sync folder + if [[ "$(stat -c '%U' /home/${USER_NAME})" != "${USER_NAME}" ]]; then + chown "${USER_NAME}":"${USER_NAME}" "/home/${USER_NAME}" + fi } @@ -213,13 +218,10 @@ fi if [[ $status -eq 4 ]]; then echo + # Add the user user_do "$USER_NAME" - # Link up the user directory - ln -s "$CLEANED_PROJECT_ROOT" "$SITE_ROOT"; - e_catch $? "Symlink web root" --clean - # Backup httpd-vhosts.conf conf_do -b diff --git a/templates/Vagrantfile b/templates/Vagrantfile index 856d110..3d64b50 100644 --- a/templates/Vagrantfile +++ b/templates/Vagrantfile @@ -2,6 +2,9 @@ Vagrant.configure(2) do |config| # Start bash as a non-login shell config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'" + config.vm.synced_folder "#{$user_vars['DREAMBOX_PROJECT_DIR']}", + "/home/#{$user_vars['DREAMBOX_USER_NAME']}/#{$user_vars['DREAMBOX_SITE_ROOT']}" + # Run user_setup config.vm.provision 'shell', inline: '/bin/bash /usr/local/bin/user_setup',