SSH Access in DirectAdmin
51 views
Security & SSL
<h3>Enabling and Using SSH in DirectAdmin</h3>
<p>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.</p>
<h3>Checking SSH Access</h3>
<p>Not all hosting plans include SSH access. To verify whether SSH is enabled for your account:</p>
<ol>
<li>Log in to DirectAdmin.</li>
<li>Navigate to <strong>Account Manager → SSH Keys</strong> or check under <strong>Advanced Features</strong> for an SSH option.</li>
<li>If you do not see an SSH option, contact your hosting provider to request SSH access be enabled for your account.</li>
</ol>
<h3>Connecting via SSH</h3>
<p>Once SSH is enabled, connect using a terminal (macOS/Linux) or an SSH client like PuTTY (Windows):</p>
<pre><code>ssh username@yourdomain.com -p 22</code></pre>
<p>Replace <code>username</code> with your DirectAdmin username, <code>yourdomain.com</code> with your server hostname or IP, and <code>22</code> with the SSH port if your provider uses a non-standard port.</p>
<h3>Setting Up SSH Keys (Recommended)</h3>
<p>SSH keys are more secure than password-based authentication. Here is how to set them up:</p>
<ol>
<li><strong>Generate a key pair</strong> on your local machine:
<pre><code>ssh-keygen -t ed25519 -C "your_email@example.com"</code></pre>
This creates a private key (<code>id_ed25519</code>) and a public key (<code>id_ed25519.pub</code>).</li>
<li><strong>Upload the public key</strong> to DirectAdmin by navigating to <strong>SSH Keys</strong> and pasting the contents of your <code>id_ed25519.pub</code> file. Alternatively, copy it manually:
<pre><code>ssh-copy-id -i ~/.ssh/id_ed25519.pub username@yourdomain.com</code></pre></li>
<li><strong>Test the connection:</strong>
<pre><code>ssh username@yourdomain.com</code></pre>
You should connect without being prompted for a password.</li>
</ol>
<div class="alert alert-warning"><strong>Security tip:</strong> Always protect your private key with a passphrase. Never share your private key with anyone. Only the public key (<code>.pub</code> file) should be uploaded to the server.</div>
<h3>Common SSH Commands</h3>
<ul>
<li><code>ls -la</code> – List files with details</li>
<li><code>cd public_html</code> – Change to web directory</li>
<li><code>du -sh *</code> – Check disk usage</li>
<li><code>tar -czf backup.tar.gz public_html/</code> – Create a compressed archive</li>
<li><code>mysql -u dbuser -p dbname</code> – Connect to MySQL</li>
</ul>
Need More Help?
Can't find what you're looking for? Our support team is ready to help.
Contact Support