Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using Ubuntu Server 13.04 and want to use OpenSSH for sftp. I have everything set up and the only thing not working is the Two Factor Authentication. Currently it asks for a password or the public key but I need it to ask for a password AND a public key.

It seams that there is a parameter in the sshd_config for that:


It is listed here:

So I added this line to the /etc/sshd_config

RequiredAuthentications2 publickey,password

But sshd -t would always give this error

/etc/ssh/sshd_config: line 26: Bad configuration option: RequiredAuthentications2

My version of OpenSSH is 6.1.p1-4. From this post I figured that it is only available in openssh-6.2: (The last post):

To test this on another computer with Linux Mint i tried to compile this version from source as it is not available for Ubuntu stable.

I did this using auto-apt as suggested in these tutorials -1 -2

The result is the same on the Linux Mint Computer.

So I'm stuck for the moment.

P.S.: Somewhere else I found you could use a second authentication script but I'm not sure if this is a good and secure solution. I want to use the server with normal ftp programs like WinSCP or Filezilla from Windows. I don't know if they would understand that way of authentication.

share|improve this question
up vote 9 down vote accepted

I was finally able to solve the problem.

Since version 6.2 of opensshd there is in fact a parameter for 2 factor authentication. Instead of RequiredAuthentications it's AuthenticationMethods. The parameters for that are the same.

As there is no deb package in Ubuntu for version 6.2 you have to compile it yourself but with auto-apt it's really easy.

share|improve this answer

Just drop password login support and only allow login with keys. Your users can protect the keys with a pass phrase when createing them and that would be as secure.

As it looks as the option you want isn't there for the version of ssh packed, you need to compile the software and manage the security of ssh yourself or wait until the right version are packed. I would wait.

share|improve this answer
Hi Anders, thanks for your answer but i finally solved the problem. See Above! – soerensen May 29 '13 at 15:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.