在设置期间设置vagrant主目录

在设置期间设置vagrant主目录,vagrant,virtualbox,Vagrant,Virtualbox,我有一个虚拟机,我正在拉下来与流浪汉和使用一个非常基本的流浪汉文件 Vagrant.configure(2) do |config| # The most common configuration options are documented and commented below. # For a complete reference, please see the online documentation at # https://docs.vagrantup.com. #

我有一个虚拟机,我正在拉下来与流浪汉和使用一个非常基本的流浪汉文件

Vagrant.configure(2) do |config|
  # The most common configuration options are documented and commented below.
  # For a complete reference, please see the online documentation at
  # https://docs.vagrantup.com.

  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://atlas.hashicorp.com/search.
  config.vm.box = "vagrant-rhel-devel"

  config.vm.network :private_network, ip: "192.168.33.101"
  config.vm.synced_folder ".", "/vagrant"

  config.ssh.username = "vagrant"
  config.ssh.password = "vagrant"

 config.vm.provider "virtualbox" do |vb|
    # Display the VirtualBox GUI when booting the machine
    # vb.gui = true

    # Enable 3d Rendering
    vb.customize ["modifyvm", :id, "--accelerate3d", "on"]

    # Sets 32megs video ram, higher number here = more POWERS
    vb.customize ["modifyvm", :id, "--vram", "32"]

  #   # Customize the amount of memory on the VM:
  #   vb.memory = "1024"

    vb.name = "RedHat 3D"

  end
end
我的问题是,流浪用户获得了一个主目录
/localhome/vagrant
,我希望他将
/home/vagrant
作为主目录


这是我可以通过资源调配来改变的,还是虚拟机本身设置的?目前我在配置步骤上还不熟练,所以举个例子就好了。

在创建用户时设置了
HOME
目录,所以这是在VM打包为vagrant box之前完成的

,您应该可以使用

usermod -m -d /path/to/new/home/dir userNameHere
所以在你的情况下是这样的

usermod -m -d /home/vagrant vagrant
检查/localhome目录下是否有需要复制到新目录中的现有文件(bash首选项文件)


如果您不打算从此框中销毁/创建一组新VM,则不需要添加为资源调配;如果您确实计划使用此框并创建大量新VM,那么这可能是有意义的,您只需要添加一个
内联shell
配置

在创建用户时设置了
目录,因此这是在VM打包为vagrant box之前完成的

,您应该可以使用

usermod -m -d /path/to/new/home/dir userNameHere
所以在你的情况下是这样的

usermod -m -d /home/vagrant vagrant
检查/localhome目录下是否有需要复制到新目录中的现有文件(bash首选项文件)


如果您不打算从此框中销毁/创建一组新VM,则不需要添加为资源调配;如果您确实计划使用此框并创建许多新的VM,那么它可能是有意义的,您只需要添加一个
内联shell
配置

您在哪里下载了此框?把localhome作为主目录听起来很奇怪你从哪里下载了这个盒子?将localhome作为主目录听起来很奇怪