SSH Access in DirectAdmin

7 vues Security & SSL

Enabling and Using SSH in DirectAdmin

SSH (Secure Shell) provides encrypted command-line access to your hosting account. This is useful for running scripts, managing files, using Git, and performing advanced server tasks that are not available through the web interface.

Checking SSH Access

Not all hosting plans include SSH access. To verify whether SSH is enabled for your account:

  1. Log in to DirectAdmin.
  2. Navigate to Account Manager → SSH Keys or check under Advanced Features for an SSH option.
  3. If you do not see an SSH option, contact your hosting provider to request SSH access be enabled for your account.

Connecting via SSH

Once SSH is enabled, connect using a terminal (macOS/Linux) or an SSH client like PuTTY (Windows):

ssh username@yourdomain.com -p 22

Replace username with your DirectAdmin username, yourdomain.com with your server hostname or IP, and 22 with the SSH port if your provider uses a non-standard port.

Setting Up SSH Keys (Recommended)

SSH keys are more secure than password-based authentication. Here is how to set them up:

  1. Generate a key pair on your local machine:
    ssh-keygen -t ed25519 -C "your_email@example.com"
    This creates a private key (id_ed25519) and a public key (id_ed25519.pub).
  2. Upload the public key to DirectAdmin by navigating to SSH Keys and pasting the contents of your id_ed25519.pub file. Alternatively, copy it manually:
    ssh-copy-id -i ~/.ssh/id_ed25519.pub username@yourdomain.com
  3. Test the connection:
    ssh username@yourdomain.com
    You should connect without being prompted for a password.
Security tip: Always protect your private key with a passphrase. Never share your private key with anyone. Only the public key (.pub file) should be uploaded to the server.

Common SSH Commands

  • ls -la – List files with details
  • cd public_html – Change to web directory
  • du -sh * – Check disk usage
  • tar -czf backup.tar.gz public_html/ – Create a compressed archive
  • mysql -u dbuser -p dbname – Connect to MySQL
Besoin d'aide ?

Vous ne trouvez pas ce que vous cherchez ? Notre équipe de support est prête à vous aider.

Contacter le support
Bonjour ! Comment pouvons-nous vous aider ?
Discuter