# How can you change the order in which SSH tries different authentication methods?

**URL:** <https://hostingthreads.com/t/how-can-you-change-the-order-in-which-ssh-tries-different-authentication-methods/44>\
**Category:** Linux Troubleshooting\
**Tags:** linux, ssh\
**Created:** [March 27, 2026, 9:55pm UTC](https://hostingthreads.com/t/how-can-you-change-the-order-in-which-ssh-tries-different-authentication-methods/44 "2026-03-27T21:55:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jennifer](https://hostingthreads.com/user_avatar/hostingthreads.com/jennifer/32/27_2.png) [@jennifer](https://hostingthreads.com/u/jennifer)\
**Post date:** [March 27, 2026, 9:55pm UTC](https://hostingthreads.com/t/how-can-you-change-the-order-in-which-ssh-tries-different-authentication-methods/44/1 "2026-03-27T21:55:39Z")

</div>

Hello Guys, How can I define the sequence in which the SSH client attempts different authentication methods when connecting to a remote host?

Thank you, Jenn 👧

---

<div class="post-metadata">

**Author:** ![richardhaxel](https://hostingthreads.com/user_avatar/hostingthreads.com/richardhaxel/32/26_2.png) [@richardhaxel](https://hostingthreads.com/u/richardhaxel)\
**Post date:** [March 27, 2026, 10:19pm UTC](https://hostingthreads.com/t/how-can-you-change-the-order-in-which-ssh-tries-different-authentication-methods/44/2 "2026-03-27T22:19:54Z")

</div>

Hello Jennifer,

The PreferredAuthentications option determines the order in which the SSH client tries different authentication methods during connection. This lets you prioritize one method (for example keyboard-interactive) over another (such as password).

To set this order, you should add the PreferredAuthentications directive to the /etc/ssh/ssh\_config file, followed by the list of authentication methods in your desired sequence.

First, open the ssh\_config file with following command.

```auto
 # vim /etc/ssh/ssh_config 

```

First, open the ssh\_config file and add the following lines and save it.

```auto
 PreferredAuthentications password,keyboard-interactive,publickey,hostbased,gssapi-with-mic

```

The default authentication order in RHEL 6 and RHEL 7 is:

```auto
gssapi-with-mic,hostbased,publickey,keyboard-interactive,password

```

Let me know if you need more help on this.

😀
