{"record":{"id":"de1e63628840d46c","repo":"hashicorp/vagrant","slug":"the-home-directory-you-specified-is-not-accessible","errorCode":null,"errorMessage":"The home directory you specified is not accessible. The home\ndirectory that Vagrant uses must be both readable and writable.\n\nYou specified: %{home_path}","messagePattern":"The home directory you specified is not accessible\\. The home\ndirectory that Vagrant uses must be both readable and writable\\.\n\nYou specified: %(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::HomeDirectoryNotAccessible","httpStatus":null,"severity":"error","filePath":"lib/vagrant/environment.rb","lineNumber":866,"sourceCode":"      dirs    = [\n        @home_path,\n        @home_path.join(\"rgloader\"),\n        @boxes_path,\n        @data_dir,\n        @gems_path,\n        @tmp_path,\n        @machine_index_dir,\n      ]\n\n      # Go through each required directory, creating it if it doesn't exist\n      dirs.each do |dir|\n        next if File.directory?(dir)\n\n        begin\n          @logger.info(\"Creating: #{dir}\")\n          FileUtils.mkdir_p(dir)\n        rescue Errno::EACCES, Errno::EROFS\n          raise Errors::HomeDirectoryNotAccessible, home_path: @home_path.to_s\n        end\n      end\n\n      # Attempt to write into the home directory to verify we can\n      begin\n        # Append a random suffix to avoid race conditions if Vagrant\n        # is running in parallel with other Vagrant processes.\n        suffix = (0...32).map { (65 + rand(26)).chr }.join\n        path   = @home_path.join(\"perm_test_#{suffix}\")\n        path.open(\"w\") do |f|\n          f.write(\"hello\")\n        end\n        path.unlink\n      rescue Errno::EACCES\n        raise Errors::HomeDirectoryNotAccessible, home_path: @home_path.to_s\n      end\n\n      # Create the version file that we use to track the structure of","sourceCodeStart":848,"sourceCodeEnd":884,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/lib/vagrant/environment.rb#L848-L884","documentation":"Raised as Vagrant::Errors::HomeDirectoryNotAccessible from home-directory setup (lib/vagrant/environment.rb:866) when FileUtils.mkdir_p on a required directory under the Vagrant home (~/.vagrant.d or $VAGRANT_HOME — the subdirectories include tmp and the machine index dir) raises Errno::EACCES or Errno::EROFS. It aborts environment creation before Vagrant can do anything else.","triggerScenarios":"The home directory path exists but is owned by another user (classic after one `sudo vagrant` run creates root-owned dirs under ~/.vagrant.d), sits on a read-only filesystem (EROFS in containers/appliances), or $VAGRANT_HOME points at an unwritable location.","commonSituations":"Alternating sudo and normal-user vagrant invocations; CI containers with read-only $HOME; VAGRANT_HOME redirected to a root-created or NFS-root-squashed path.","solutions":["Inspect ownership: `ls -ld ~/.vagrant.d` (and `echo $VAGRANT_HOME`), then take it back: `sudo chown -R $(id -u):$(id -g) ~/.vagrant.d`","If VAGRANT_HOME points somewhere unwritable, point it at a writable directory or unset it","On a read-only root filesystem, give Vagrant a writable home: `export VAGRANT_HOME=/tmp/vagrant.d`","Stop running vagrant under sudo, or keep home ownership consistent when root is unavoidable"],"exampleFix":"# before\n$ sudo vagrant up        # creates root-owned ~/.vagrant.d subdirs\n$ vagrant status          # HomeDirectoryNotAccessible\n\n# after\n$ sudo chown -R $(id -u):$(id -g) ~/.vagrant.d\n$ vagrant status","handlingStrategy":"validation","validationCode":"home = ENV[\"VAGRANT_HOME\"] || File.expand_path(\"~/.vagrant.d\")\nwritable = File.writable?(home) rescue false\nwritable ||= !File.exist?(home) && File.writable?(File.dirname(home))\nraise ArgumentError, \"vagrant home #{home} is not writable\" unless writable","typeGuard":null,"tryCatchPattern":"begin\n  env = Vagrant::Environment.new\nrescue Vagrant::Errors::HomeDirectoryNotAccessible => e\n  abort \"Fix permissions on #{e.extra_data[:home_path]} (chown/chmod) or set VAGRANT_HOME\"\nend","preventionTips":["Never mix sudo and non-sudo vagrant runs under one $HOME","Set VAGRANT_HOME explicitly in containers to a writable path","After any accidental sudo run, chown ~/.vagrant.d back to your user"],"tags":["vagrant","home-directory","permissions","filesystem","eacces"],"backgroundTag":"permission-denied","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}