lib/vagrant/ssh.rb
# Checks the file permissions for the private key, resetting them
# if needed, or on failure erroring.
Checks the file permissions for the private key, resetting them
if needed, or on failure erroring.
Checks the file permissions for the private key resetting them if needed or on failure erroring .
def check_key_permissions(key_path)
      return if Mario::Platform.windows?
      stat = File.stat(key_path)
      if stat.owned? && file_perms(key_path) != "600"
        File.chmod(0600, key_path)
        raise Errors::SSHKeyBadPermissions, :key_path => key_path if file_perms(key_path) != "600"
      end
    rescue Errno::EPERM
      raise Errors::SSHKeyBadPermissions, :key_path => key_path
    end
def check_key_permissions ( key_path ) return if Mario :: Platform . windows? stat = File . stat ( key_path ) if stat . owned? && file_perms ( key_path ) != "600" File . chmod ( 0600 , key_path ) raise Errors :: SSHKeyBadPermissions , :key_path => key_path if file_perms ( key_path ) != "600" end rescue Errno :: EPERM raise Errors :: SSHKeyBadPermissions , :key_path => key_path end
Checks the file permissions for the private key, resetting them
if needed, or on failure erroring.
Checks the file permissions for the private key resetting them if needed or on failure erroring .
# Windows systems don't have this issue # This shouldn't happen since we verify we own the file, but just # in case.
key_path
<not_specific>