diff --git a/app/models/key_pair.rb b/app/models/key_pair.rb index ca8a3fe8c..e6bb7a246 100644 --- a/app/models/key_pair.rb +++ b/app/models/key_pair.rb @@ -21,9 +21,7 @@ class KeyPair < ActiveRecord::Base protected def check_keys - tmp = "#{APP_CONFIG['root_path']}/tmp" - system "sudo chown `whoami` #{tmp} && chmod 1777 #{tmp}" - dir = Dir.mktmpdir('keys-', tmp) + dir = Dir.mktmpdir('keys-', '/tmp') begin %w(pubring secring).each do |kind| filename = "#{dir}/#{kind}" diff --git a/app/models/ssh_key.rb b/app/models/ssh_key.rb index a2c615585..ec09df1ce 100644 --- a/app/models/ssh_key.rb +++ b/app/models/ssh_key.rb @@ -22,7 +22,7 @@ class SshKey < ActiveRecord::Base def set_fingerprint return false unless key - file = Tempfile.new('key_file', "#{APP_CONFIG['root_path']}/tmp") + file = Tempfile.new('key_file', '/tmp') filename = file.path begin file.puts key