diff --git a/go/libkb/json.go b/go/libkb/json.go
index <HASH>..<HASH> 100644
--- a/go/libkb/json.go
+++ b/go/libkb/json.go
@@ -96,7 +96,7 @@ func (f *JSONFile) Save(pretty bool, mode os.FileMode) error {
 // SaveTmp saves the config to a temporary file.  It returns the
 // filename and any error.
 func (f *JSONFile) SaveTmp(suffix string) (string, error) {
-	filename := path.Join(os.TempDir(), fmt.Sprintf("keybase_config_%s.json", suffix))
+	filename := path.Join(path.Dir(f.filename), fmt.Sprintf("keybase_config_%s.json", suffix))
 	if err := f.save(filename, true, 0); err != nil {
 		return "", err
 	}
Save tmp file in same directory as real file