A brute-force attack is a method of guessing credentials by trying different combinations of usernames and passwords. To protect against it, it is recommended to set a limit on the number of login attempts, use complex and unique passwords, and set up two-factor authentication.