SSH/Telnet and .htaccess

CybrHost suggests you use a SSH client for all communications to the server including uploading and downloading files. Why? SSH provides a fully secure bi-directional interface such that all data transferred in both directions is always encoded. It is quite difficult for a hacker to obtain worthwhile data when using SSH. SCP is a natural extension off of a SSH connection so I believe most SSH clients also provide SCP.

The following "free" clients are recommended for interoperating with OpenSSH from Windows machines:

Mac OS X includes OpenSSH by default. The following clients are recommended for interoperating with OpenSSH from Mac OS 9 machines:

To Restrict Entry via .htaccess
Create a .htaccess file in a text editor, FTP that file to your site, then using TELNET or SSH to create the .htpasswd fileby typing:

vi .htaccess

A typical /htaccess file for restricted entry is:

AuthUserFile /home/sites/site10/html/restricted/.htpasswd
AuthName "CybrHost .htaccess Example"
AuthType Basic
<Limit GET>
require valid-user

When you have entered the file you can update the file, if using vi, by typing <shift>ZZ.

Next type /etc/stronghold/bin/htpasswd -c .htpasswd username (using TELNET) to create the file and add "username" as the first user. The program will prompt you for a password, then verify by asking again. You will not see the password when entering it here:

/etc/stronghold/bin/htpasswd -c .htpasswd username
Adding password for username.
New password:
Re-type new password:

To add more users in the future, use the same command without the -c switch:

/etc/stronghold/bin/htpasswd .htpasswd bob ("bob" will be added to your .htpasswd file.)

To delete users, open the .htpasswd file in a text editor and delete the appropriate lines:


Custom Error Files
For custom error files create a .htaccess file that will be located in your 'root' (/html for CybrHost) directory. This file will typically be hidden from FTP programs since the name begins with a period '.'! You must also create a 'PAGE' displaying the custom error text you wish to use.

An example of entries for a .htaccess file could be:

ErrorDocument 400 /error400.html
ErrorDocument 401 /error401.html
ErrorDocument 403 /error403.html
ErrorDocument 404 /error404.html
ErrorDocument 500 /error500.html

An example for using a standard .html error page would be:

Image Theft
Many people like to steal images from your site and by doing so consume your available bandwidth. To prevent this type of abuse create a .htaccess file in your html directory as follows:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^*$ [NC]
RewriteCond %{HTTP_REFERER} !^*$ [NC]
RewriteRule .*\.jpg$ - [F]

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^*$ [NC]
RewriteCond %{HTTP_REFERER} !^*$ [NC]
RewriteRule .*\.gif$ - [F]

That's it!