After changing the file permissions, we need to reload the stat before comparing again. Otherwise we will always throw an exception even if we set the permissions successfully.

This commit is contained in:
Sean Wolfe 2012-05-01 13:26:12 -07:00
parent 804f6411fa
commit e10e8aae86
1 changed files with 1 additions and 0 deletions

View File

@ -113,6 +113,7 @@ module Vagrant
@logger.info("Attempting to correct key permissions to 0600")
File.chmod(0600, key_path)
stat = File.stat(key_path)
if Util::FileMode.from_octal(stat.mode) != "600"
raise Errors::SSHKeyBadPermissions, :key_path => key_path
end