hashicorp/vagrant · error · Vagrant::Errors::SCPPermissionDenied

Failed to upload a file to the guest VM via SCP due to a per

Error message

Failed to upload a file to the guest VM via SCP due to a permissions
error. This is normally because the SSH user doesn't have permission
to write to the destination location. Alternately, the user running
Vagrant on the host machine may not have permission to read the file.

Source: %{from}
Dest: %{to}

What it means

Error "Failed to upload a file to the guest VM via SCP due to a permissions error. This is normally because the SSH user doesn't have permission to write to the destination location. Alternately, the user running Vagrant on the host machine may not have permission to read the file. Source: %{from} Dest: %{to}" thrown in hashicorp/vagrant.

Source

Thrown at plugins/communicators/ssh/communicator.rb:406

              upload_file = File.open(path, "rb")
              begin
                scp.upload!(upload_file, dest)
              ensure
                upload_file.close
              end
            end
          end
          uploader.call(from)
        end
      rescue RuntimeError => e
        # Net::SCP raises a runtime error for this so the only way we have
        # to really catch this exception is to check the message to see if
        # it is something we care about. If it isn't, we re-raise.
        raise if e.message !~ /Permission denied/

        # Otherwise, it is a permission denied, so let's raise a proper
        # exception
        raise Vagrant::Errors::SCPPermissionDenied,
          from: from.to_s,
          to: to.to_s
      end

      def reset!
        if @connection
          @connection.close
          @connection = nil
        end
        @ssh_info_notification = true # suppress ssh info output
        wait_for_ready(5)
      end

      def generate_environment_export(env_key, env_value)
        template = machine_config_ssh.export_command_template
        template.sub("%ENV_KEY%", env_key).sub("%ENV_VALUE%", env_value) + "\n"
      end

View on GitHub (pinned to 35f3160f4a)

When it happens

Trigger: Thrown at plugins/communicators/ssh/communicator.rb:406 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21). Data as JSON: /api/errors/618ab407e324b7e3. Report an issue: GitHub.