diff --git a/tests/unit/modules/test_ssh.py b/tests/unit/modules/test_ssh.py
index <HASH>..<HASH> 100644
--- a/tests/unit/modules/test_ssh.py
+++ b/tests/unit/modules/test_ssh.py
@@ -91,8 +91,13 @@ class SSHAuthKeyTestCase(TestCase, LoaderModuleMockMixin):
         email = 'github.com'
         empty_line = '\n'
         comment_line = '# this is a comment \n'
+
         # Write out the authorized key to a temporary file
-        temp_file = tempfile.NamedTemporaryFile(delete=False)
+        if salt.utils.is_windows():
+            temp_file = tempfile.NamedTemporaryFile(delete=False)
+        else:
+            temp_file = tempfile.NamedTemporaryFile(delete=False, mode='w+')
+
         # Add comment
         temp_file.write(comment_line)
         # Add empty line for #41335
Add mode back in for tmp file creation on Linux

The mode arg was removed in PR #<I> to get this test to pass on
Windows. However, this caused the same test to fail on Arch Linux
when running Python 3.

Let's keep the test the way it was for non-windows boxes, and only
remove the mode for windows.