Beginning with Joomla 1.6 it's possible to lock anyone out of the back end of the website — including Super Users with Admin permissions — by setting the Site Admin permission to Deny. And this is something you can do accidentally against yourself by playing with the permissions without knowing how exactly these settings are working. That can have unpleasant side effects especially at the Super User group or at the Manager or Administrator group level. If Manager or Administrator is set to Deny, the Super User would inherit Deny from these groups, even if the Super User group is set to Allow.
Fortunately, there is a "back door" that will let you log into your website again. You must have access to the files on the web server in order to make the back door work. You can either use FTP to access the files, or you can go through your site's control panel to a file manager and edit the files on the server.
However you access your files, you'll need to edit the configuration.php file, located in the root of your website. You will need to know the Super User username or their ID. Let's assume that the Super User username is "someuser" for this example, and it's the default SuperAdministrator of the site, which has the UserID 62. (For security reasons, it's strongly recommended that you remove as soon as possible the default Super Administrator, and set up one which use something other than admin as a username for your Joomla site.)
Add this line of code to the bottom of configuration.php:
If you prefer, you could also use the ID of the user (although it's less likely you'd know this without looking up for the exact UserID in the database):