Why am I denied access via FTP?

There might be occasions when you are unable to access the web site via FTP. This could be because of the following reasons:

  • Internet connectivity issues: Your Internet connection might be disrupted. Check whether you are able to connect to the Internet, then try again.
  • Firewalls: You might have a firewall blocking access to your site. Ensure that this access is un-blocked and try again.

    What is a Firewall?
    A firewall is a piece of hardware and/or software which functions in a networked environment to prevent some communications forbidden by the security policy. Firewalls can come in the form of hardware or software. Without getting into the complex details of how firewalls work, it would suffice to say that they function with a set of filters that are constantly monitoring traffic on the network. Whenever a packet of information triggers one of the filters, the firewall prevents it from passing through in the attempt to prevent damage. Of course, firewalls sometimes block wanted traffic (like your FTP access in this case) – however, through a continual process of refinement, the filters can be customized to improve their effectiveness.

  • Using FTP in Active mode: FTP can be used in either of 2 modes – Active or Passive. All HamaraHost.com Windows and Linux web servers support both Active as well as Passive modes. The mode of FTP chosen may not cause you problems while connecting and uploading via FTP, but you might encounter occasional errors while getting directory listings.

Using FTP to upload files to your website

FTP stands for File Transfer Protocol. Essentially, it is a simple tool to move files from one computer to another computer.

FTP works only on port 21 for HamaraHost.com Windows Web Hosting packages.

How would FTP work for me?

Lets assume that you have created a web site for yourself, and you have seventy-five web pages that you want to display to people. Instead of copying all of the files to disks and manually placing
the files on the Web Server, you could open an FTP client, find the Web Server, navigate to the directory where you need to place the files, and then upload the files.

Thus, FTP is simply used:

  • to download a file from a server using the Internet, or
  • to upload a file to a server (e.g. uploading a web page file to a Server).

Few FTP Clients

FTPS

FTPS (also known as FTP Secure or FTP-SSL) is an extension to the commonly used File Transfer Protocol (FTP) that adds support for the Transport Layer Security (TLS) and the Secure Sockets Layer (SSL) cryptographic protocols.

FTPS works only on port 21 for both HamaraHost.com cPanel Linux Web Hosting and Plesk Windows Web Hosting packages.
Some FTP clients support both FTPS modes: Explicit and Implicit. In such FTP clients, the Explicit (FTPES) mode needs to be selected.

Few FTP clients supporting FTPS

SFTP

SFTP, or secure FTP, is a program that uses SSH (Secure Shell) Protocol to transfer files. It is functionally similar to FTP. However, unlike standard FTP, it encrypts both commands and data, preventing passwords and sensitive information from being transmitted in the clear over the network.

SFTP works only on port 22 for any HamaraHost.com Linux Web Hosting package.

Few FTP clients supporting SFTP

It is advisable to not use WS_FTP client to upload content to a website hosted on HamaraHost.com’s Linux Hosting Servers.

My site was hacked. What to do?

Security is an interesting topic, with a lot of shades of gray. HamaraHost.com takes security very seriously, but as with any other system, there are potential security issues that may arise and there are always trade offs when balancing security and convenience. We will go through some common things you can do to keep your website secure.

What is security? Fundamentally, security is not about perfectly uncrackable systems, which might well be impossible to find and/or maintain. Security has more to do with trust and responsiveness. For example, a trusted host runs a stable, patched branch of their webserver (be it Apache, IIS, or whatever). They should tell you this, test their configuration themselves, and let you determine it for yourself. An untrusted host does not apply patches when they are released and does not tell you what server versions they are running.

Several themes run through this guide:

  1. Limiting access: Making smart choices that effectively lower the possible entry points available to a malicious person.
  2. Containment: If a weak point in your Website is found by a malicious person, your system should be configured to minimize the amount of damage that can be done once inside your system.
  3. Knowledge: Keeping backups, knowing the state of your Website at regular time intervals, documenting your modifications all help you understand your installation.

Stay Calm

If your site is hacked, you have to stay calm to be able to deal with this situation. The first step before you respond to any security incident is to calm yourself down to make sure you do not commit any mistakes. We are serious about it.

Vulnerabilities on your computer

Make sure the computers you use to FTP access your Website are free of spyware, malware, adware, and virus infections; and are running secure, stable versions of your applications. For example, none of the following makes the slightest difference if there is a keylogger on your PC.

Scan your local machine.: Sometimes the malware was introduced through a compromised desktop system. Make sure you run a full anti-virus/malware scan on your local machine. Some viruses are good at detecting AV software and hiding from them. So maybe try a different one. This advice generally only applies to Windows systems. If you do not have any AV software installed on your computer, you could use ClamAV for Windows-based PCs or ClamXav for Macs. ClamAV is also available for Linux and BSD systems.


Vulnerabilities in the Website itself

Your Website could have vulnerabilities as a result of how the program is written that allow an attacker to pass HTTP arguments, bad URI strings, form input, etc, that could cause Bad Things to happen.

There are two ways to deal with this problem:

  1. Keep up to date with the latest version: Developers do not maintain security patches for older package versions. Once a new version has been released or the vulnerability has been fixed then the information required to exploit the vulnerability is almost certainly in the public domain making any old versions more open to attack by a simple script kiddie..

  2. Report bugs: If you find what you think is a bug, report it. You might have uncovered a vulnerability, or a bug that could lead to one.


Server vulnerabilities

The webserver running your Wesbsite, the database with the data, PHP and any other scripting/programming language used for plugins or helper apps could have vulnerabilities. Therefore, make sure you are running secure, stable versions of your web server, database, scripting interpreter, or make sure you are using a trusted host that takes care of these things for you.

It should also be mentioned that if you’re on a shared server (one that hosts other people besides yourself) if someone else is compromised, then it’s very likely you could be compromised too even if you follow everything in this guide. Be sure to ask your web host what security precautions they take.


Network vulnerabilities

The network on both ends — the server side and the client network side — should be trusted. That means updating firewall rules on your home router and being careful about what networks you work from. A busy Internet cafe where you are sending passwords in cleartext over an unencrypted wireless connection is not a trusted network, for example. Your host should be making sure that their network is not poisoned by hackers, and you should do the same. Network vulnerabilities allow passwords to be intercepted via sniffers and other sorts of havoc (such as man-in-the-middle attacks) to happen.


Passwords

Some vulnerabilities can be avoided by good security habits. An important element of this are passwords: do not use your own name for your password, do not use a dictionary word (from any language) for your password, do not use a 4 character string of numbers as your password. Your goal with your password is to make the search space as large as possible, so using numbers and varying capitalization all make it more difficult, statistically, to brute force a password. This is particularly important if you do not rename the administrator account. In that case half the puzzle is already solved for malicious users as they know what username will give them significant privileges to edit files and databases. Many automatic password generators can be found on the internet and used to create secure passwords.

A strong admin password is necessary not just to protect the site/blog content; but also to protect against a hacker for instance uploading a script or doing other damage which could result in a compromise of the entire Website – in other words if a hacker gains access to the admin area they can do a lot more damage than simply changing the content.

Change the passwords again!: Remember, you need to change the passwords for your site after making sure your site is clean. So if you only changed them when you discovered the hack, change them again now.

When connecting to your server you should use encryption if your web host allows. Using encryption or FTPS is the same as traditional FTP, except your password and content is encrypted as it copied from your computer to your website. This means your password is never sent in the clear. Alternatively you can also use SSH to connect to your server, again if your web host allows.


File permissions

Some websites allow some files to be writable by web server. However, letting an application have write access to your files is a dangerous thing, particularly in a public environment.

It is best, from a security perspective, to lock down your file permissions as much as possible and to loosen those restrictions on the occasions that you need to allow write access, or to create special folders with more lax restrictions for the purpose of doing things like uploading images.

Here is one possible permission scheme.

All files should be owned by your user account, and should be writable by you.


Database security

If you run multiple websites/blogs on the same server, it is wise to consider keeping them in separate databases each managed by a different user. This is a containment strategy: if an intruder successfully cracks one of Website, this makes it that much harder to alter your other blogs/websites.

If you administer MySQL yourself, ensure that you understand your MySQL configuration and that unneeded features (such as accepting remote TCP connections) are disabled. See Secure MySQL Database Design for a nice introduction.


Data backups

Backup your data regularly, including your MySQL databases. Data integrity is critical for trusted backups. Encrypting the backup, keeping an independent record of MD5 hashes for each backup file, and/or placing backups on read-only media (such as CD-R) increases your confidence that your data has not been tampered with.

A sound backup strategy could include keeping a set of regularly-timed snapshots of your entire Website (including core files and your database) in a trusted location. Imagine a site that makes weekly snapshots. Such a strategy means that if a site is compromised on May 1st but the compromise is not detected until May 12th, the site owner will have pre-compromise backups that can help in rebuilding the site and possibly even post-compromise backups which will aid in determining how the site was compromised.


Monitoring

Sometimes prevention is not enough and you may still be hacked. That’s why intrusion detection/monitoring is very important. It will allow you to react faster, find out what happened and recover your blog back in place.

Monitoring your logs: If you are on a private server (where you have admin access), you have to watch your logs to detect password guessing attempts, web attacks, etc. A good open source solution to monitor your logs in real time and block the attacker is OSSEC.

Monitoring your files for changes: When an attack happens, it always leave traces. Either on the logs or on the file system (new files, files modified, etc). If you are using OSSEC that we recommended above, it will monitor your files and alert when they change as well.

Monitoring your web server externally for malware and changes: If the attacker tries to deface your site or add malware, you can also detect these changes by using a web-based integrity monitor solution.

FTP error: access denied (reason code 3E-09)

Symptom

You receive an error similar to the following when attempting to log into your FTP account:

421 Not logged in, access denied (reason code 3E-09).
Connection closed by remote host.

OR

You may get a connection timeout/rejection when trying to connect via FTP, HTTP or any protocol.

The symptoms may vary based on which server you are hosted on. Due to some variations in HamaraHost.com infrastructure, some servers may block with the 3E-09 code, and some servers may simply block all traffic from your IP address.

Answer

This indicates our security mechanisms have been activated due to suspicious activity related to your account.

The most common scenario is that your IP has been blocked due to failed FTP login attempts.

The first step to address this is to have us remove the block against your IP (directions below).

Next, you need to identify and stop the failed login attempts from your IP. The most common reason is due to the use of IE (Internet Explorer) for making an FTP connection. Frequently, customers will use Internet Explorer, and specify the FTP connection in the address bar using ftp://ftp.mydomain.com. This causes IE to attempt to login using anonymous login, and since we don’t allow anonymous access to the FTP server, this is considered a failed login. Unfortunately, IE makes multiple attempts like this automatically, and will then ultimately prompt you for your ftp username and password. But at that point, it’s too late, multiple failed login attempts have already triggered our intrusion detection mechanisms to block your IP address. You can continue to use IE, just modify the way you use it… instead of putting ftp://ftp.mydomain.com in the address bar, put ftp://user:password@ftp.mydomain.com in the address bar. This provides IE the ftp credentials right up front, and it makes no anonymous connection attempts… instead it presents your login credentials on the first attempt.

To have your IP removed from the block, submit a ticket to the support team specifying the error message you get , and providing us your IP address. If you’ve reviewed this article, please let us know that, so we’ll know you’re familiar with the scenario, and ask that we unblock your IP address.

TO FIND YOUR IP ADDRESS

Some folks are behind a NAT device and don’t even know it, which can mean they have one IP address on their PC, but another is used when connecting to the internet. We strongly recommend you simply use this URL which will identify the IP address associated with your PC when you’re accessing internet sites: http://www.whatismyip.com/

If you’re not using IE, or are otherwise unable to determine why you’re triggering the blocking again even after we remove you from the blocking, we can whitelist your IP or your FTP user so you’re not blocked in future. Simply submit a support request indicating you’d like to be whitelisted from FTP intrusion detection security, and specify which of the following whitelisting options you prefer:

  1. Whitelisting your IP address:  Best choice for customers with dedicated/static IPs or IPs that change infrequently.
  2. Whitelisting yoru FTP username: Best choice for customers with frequently changing IPs, however less secure.

How do I set up FTP access to my domain in Plesk?

1. Log into Plesk at https://your-domain-name:8443 as admin (replace your-domain-name with your ip or domain name)

2. Click on domains link (on the left hand side)

3. Click on your domain

4. click on Setup

5. Scroll down to Account Preferences where you will see a section to enter a username for ftp login, below that you can set or reset your ftp login password

6. Press ok to save this info

You will now be able to access your ftp from within a browser such as Internet Explorer -ftp://username:password@your-domain-name

Replace username with your username and password with the password you set, and replace the your-domain-name with your ip or real domain name.

You can alternatively access it using an ftp client application, such as Cute ftp, FileZilla or CoreFTP.