This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| 2fa [2024/10/28 14:55] – hogwild | 2fa [2025/08/13 04:51] (current) – -Change to: "The default file location is /opt/etc/environment" hogwild | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| This content was taken from a Tomato forum thread: [[https:// | This content was taken from a Tomato forum thread: [[https:// | ||
| - | These are simple configuration notes, and not intended to be a complete HOWTO. | + | These are simple configuration notes, and not intended to be a complete HOWTO.  | 
| - | This setup uses openssh with google-authenticator as 2-Factor Authentication. Only the root user is supported.\\ | + | Install openssh-server and google-authenticator: | 
| - | \\ | + | |
| - |  \\ **Prerequisites: | + | |
| - | + | ||
| - |     Next, install  | + | |
| \\ | \\ | ||
| Line 17: | Line 13: | ||
| \\ | \\ | ||
| - | Hopefully,  | + | If this completes without  | 
| - | \\ | + |   | 
| - | \\ | + | Next, enable openssh-server . This is not covered here. | 
| - | Next, enable openssh-server . This is not covered here.\\ \\ | + |  \\ \\ Configure the correct settings in configuration file / | 
| - | Configure the correct settings in configuration file / | + | \\ | 
| #!/bin/sh | #!/bin/sh | ||
| Line 54: | Line 50: | ||
| \\ | \\ | ||
| - | The new service must be enabled at boot time as well: | + | The new service must be enabled at boot time as well. Make the following changes to the file: "/ | 
| \\ | \\ | ||
| - | |||
| - | Next, run / | ||
| Port 2222 # to be changed if desired | Port 2222 # to be changed if desired | ||
| Line 73: | Line 67: | ||
| grep -v "#" | grep -v "#" | ||
| + | |||
| + | \\ | ||
| auth required pam_env.so | auth required pam_env.so | ||
| Line 113: | Line 109: | ||
| Next, move its config file (.google_authenticator) to the /opt/etc directory: | Next, move its config file (.google_authenticator) to the /opt/etc directory: | ||
| + | |||
| + | \\ | ||
| mv .google_authenticator /opt/etc/ | mv .google_authenticator /opt/etc/ | ||
| Line 119: | Line 117: | ||
| Next, Verify the permissions on the file are " | Next, Verify the permissions on the file are " | ||
| + | |||
| + | \\ | ||
|     chmod 0600 / |     chmod 0600 / | ||
| Line 125: | Line 125: | ||
| Now, you should be able to start the sshd service: | Now, you should be able to start the sshd service: | ||
| + | |||
| + | \\ | ||
|     / |     / | ||
| Line 139: | Line 141: | ||
| You should see the following: | You should see the following: | ||
| + | |||
| + | \\ | ||
|     The authenticity of host ' |     The authenticity of host ' | ||
| Line 154: | Line 158: | ||
| | Verification code: | | Verification code: | ||
| - | \\ If you see this, it means that 2FA is the only authentication operating. | + |  \\ If you see this, it means that 2FA is the only authentication operating. You can now expose port 2222 (or your configured port) to the Internet.  | 
| \\ | \\ | ||
| - | You can now expose port 2222 (or the port you configured) to the Internet. . | + | The default file location is: "/ | 
| \\ | \\ | ||
| \\ | \\ | ||
| - | |||
| - | PS - / | ||