DYEWARE TECHNOLOGY SOLUTIONS
DYEWARE HOW-TO CENTER · Security & Access Control

Secure SSH Access

Configure SSH administration so that remote access is limited, authenticated, and auditable. This guide covers key-based login, account restrictions, daemon settings, network controls, and safe validation before disconnecting.

Illustration representing secure ssh access

SSH is a powerful management channel. A weak password, exposed privileged account, or unrestricted source range can turn a single compromised credential into full server control. A secure setup reduces both the chance of unauthorized login and the impact of a stolen account.

Before You Begin

  • A working administrative session and console or out-of-band recovery access.
  • A named non-root administrator account with sudo privileges.
  • A client key pair protected by a passphrase or hardware-backed key storage.

Recommended Approach

1. Create and install a key pair

Generate an individual key pair on the administrator’s workstation. Install only the public key in the account’s authorized_keys file. Protect the private key with a passphrase and appropriate local file permissions.

2. Test key authentication

Open a second terminal and confirm that key-based login works before changing server settings. Keep the original session open until the new connection is verified.

3. Restrict the SSH daemon

Review `/etc/ssh/sshd_config` and any included configuration files. Consider disabling password authentication and direct root login after confirming key access and recovery. Use AllowUsers or AllowGroups where suitable.

4. Limit network reachability

Permit TCP port 22 only from trusted management IP ranges, VPN subnets, or a bastion host. If source addresses change, use a managed access solution rather than opening SSH to the entire internet.

5. Validate and reload safely

Run the SSH daemon configuration test before reloading. Keep an existing session open, reload the service, and test a fresh connection. Review authentication logs after the change.

Operational Considerations

Treat identity and server controls as an ongoing operating process, not a one-time setup. Assign an owner to each identity or exposed service, review access after role changes, and remove temporary exceptions when their purpose ends. Keep a record of who approved the access and how it can be revoked. For production systems, pair preventive controls with centralized logs and alerts so unusual activity can be investigated promptly.

How to Verify the Result

Validate both the normal workflow and the failure path. Confirm the intended administrator or service can complete its task, then attempt the same action from an identity or source that should not be allowed. Review authentication and system logs for the test. Finally, verify that recovery access still works and that a configuration rollback is available before closing the change.

Example Configuration

Illustrative example — adapt values to your environment

# Validate configuration before applying changes
sudo sshd -t

# On Ubuntu/Debian, reload after validation
sudo systemctl reload ssh

Common Mistakes to Avoid

  • A syntax error in sshd_config can prevent new sessions; test configuration before reload.
  • Do not disable password login until key access has been tested.
  • Do not copy one private key to multiple administrators; issue individual keys and revoke them individually.
Practical recommendation

Make one change at a time, test it from the perspective of the actual user or application, and record the reason for the change. Keep a rollback path for network, identity, and production configuration changes.

Final Checklist

  • The configuration matches the intended environment and service version.
  • Access is limited to the required identities, resources, ports, and operations.
  • The expected workflow has been tested, including a negative test for unauthorized access.
  • Secrets and temporary credentials are protected and excluded from logs and source control.
  • The configuration owner, purpose, and review or expiration date are documented.

Official Documentation

🔒

Terms of Service

By accessing or continuing to use the Dyeware website, you acknowledge that you have read, understood, and agree to our Terms of Service and Privacy Policy. If you do not agree, please discontinue use of this website.