The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SOLVED Disable Two Factor Authentication with SSH from rescue system

Discussion in 'Security' started by Mario Kos, Jul 12, 2017.

  1. Mario Kos

    Mario Kos Member

    Joined:
    Sep 4, 2015
    Messages:
    6
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Croatia
    cPanel Access Level:
    Root Administrator
    Need instructions how to disable 2FA via SSH from linux rescue system.
     
  2. Mario Kos

    Mario Kos Member

    Joined:
    Sep 4, 2015
    Messages:
    6
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Croatia
    cPanel Access Level:
    Root Administrator
    Got stuck after trying:
    Code:
    mv -v /var/cpanel/authn/twofactor_auth/tfa_userdata.json{,.bak}; echo ‘{}’ >> /var/cpanel/authn/twofactor_auth/tfa_userdata.json
    Now have a problem:
    Internal Server Error
    500
    Security Policy requires exec termination.
     
  3. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    15,618
    Likes Received:
    296
    Trophy Points:
    433
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
  4. Mario Kos

    Mario Kos Member

    Joined:
    Sep 4, 2015
    Messages:
    6
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Croatia
    cPanel Access Level:
    Root Administrator
    I know about api but can api be called if rescue system is booted?
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,064
    Likes Received:
    1,287
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Two-factor authentication should not prevent you from accessing the server via SSH as root. Once the server is booted out of rescue mode, you'd simply access the server via SSH as root and run those WHM API 1 commands.

    Thank you.
     
  6. Mario Kos

    Mario Kos Member

    Joined:
    Sep 4, 2015
    Messages:
    6
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Croatia
    cPanel Access Level:
    Root Administrator
    Firewall is preventing me from accesing, is it possible to disable 2FA from rescue mode?
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,064
    Likes Received:
    1,287
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    It's unlikely that command will work while the server is booted in rescue mode, but it depends on the OS and the specific boot options you used. You may want to check with your hosting provider to see if they provide an option to disable the firewall rules so you can access the server via SSH.

    Thank you.
     
  8. Mario Kos

    Mario Kos Member

    Joined:
    Sep 4, 2015
    Messages:
    6
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Croatia
    cPanel Access Level:
    Root Administrator
    Think local whm or csf is blocking ssh access, can you maybe instruct how to dissable csf from rescue mode?
     
  9. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,064
    Likes Received:
    1,287
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    You may find this third-party URL helpful:

    How to edit /etc/sysconfig/iptables from: RESCUE MODE boot?

    However, running an incorrect command could lead to data loss so it's generally advised to consult with a qualified system administrator or your hosting provider if you are not comfortable in rescue mode.

    Thank you.
     
  10. Mario Kos

    Mario Kos Member

    Joined:
    Sep 4, 2015
    Messages:
    6
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Croatia
    cPanel Access Level:
    Root Administrator
    Solved by disabling CSF adding file csf.disable to csf folder.
    Code:
    touch /etc/csf/csf.disable
    After reboot managed to SSH login and disable 2FA with whmapi1
    Code:
    whmapi1 twofactorauth_disable_policy
     
    cPanelMichael and Infopro like this.
Loading...

Share This Page