Аутентификация в SQL Server Authentication in SQL Server
SQL Server поддерживает два режима проверки подлинности: режим проверки подлинности Windows и режим смешанной проверки подлинности. SQL Server supports two authentication modes, Windows authentication mode and mixed mode.
Режим проверки подлинности Windows является режимом по умолчанию. Поскольку эта модель безопасности SQL Server тесно интегрирована с Windows, часто ее называют встроенной функцией безопасности. Windows authentication is the default, and is often referred to as integrated security because this SQL Server security model is tightly integrated with Windows. Для входа в SQL Server в список надежных элементов вносятся определенные учетные записи пользователей и группы Windows. Specific Windows user and group accounts are trusted to log in to SQL Server. Пользователям Windows, которые уже прошли аутентификацию, не нужно представлять дополнительные учетные данные. Windows users who have already been authenticated do not have to present additional credentials.
Режим смешанной аутентификации поддерживает проверку подлинности как средствами Windows, так и средствами SQL Server. Mixed mode supports authentication both by Windows and by SQL Server. Пары имен пользователей и паролей хранятся в SQL Server. User name and password pairs are maintained within SQL Server.
Мы рекомендуем использовать проверку подлинности Windows везде, где это возможно. We recommend using Windows authentication wherever possible. При проверке подлинности Windows используется ряд зашифрованных сообщений для проверки подлинности пользователей в SQL Server. Windows authentication uses a series of encrypted messages to authenticate users in SQL Server. А при использовании имен входа SQL Server имена входа и зашифрованные пароли SQL Server передаются по сети, что делает их менее защищенными. When SQL Server logins are used, SQL Server login names and encrypted passwords are passed across the network, which makes them less secure.
При использовании проверки подлинности Windows пользователи уже вошли в Windows и им не нужно отдельно входить еще и в SQL Server. With Windows authentication, users are already logged onto Windows and do not have to log on separately to SQL Server. Следующая строка SqlConnection.ConnectionString задает проверку подлинности Windows, не требуя имени пользователя или пароля. The following SqlConnection.ConnectionString specifies Windows authentication without requiring users to provide a user name or password.
Имена для входа отличаются от пользователей базы данных. Logins are distinct from database users. Вы должны сопоставить имена для входа или группы Windows пользователям базы данных или ролям в отдельной операции. You must map logins or Windows groups to database users or roles in a separate operation. Затем вы предоставляете пользователям или ролям разрешения на доступ к объектам базы данных. You then grant permissions to users or roles to access database objects.
Сценарии проверки подлинности Authentication Scenarios
Проверка подлинности Windows обычно является лучшим выбором в следующих ситуациях: Windows authentication is usually the best choice in the following situations:
Есть контроллер домена. There is a domain controller.
Приложение и база данных находятся на одном компьютере. The application and the database are on the same computer.
Используется экземпляр SQL Server Express или LocalDB. You are using an instance of SQL Server Express or LocalDB.
Имена для входа SQL-сервера часто используются в следующих ситуациях: SQL Server logins are often used in the following situations:
Если у вас есть рабочая группа. If you have a workgroup.
Пользователи соединяются из разных, ненадежных доменов. Users connect from different, non-trusted domains.
Существуют интернет-приложения, такие как ASP.NET. Internet applications, such as ASP.NET.
При использовании аутентификации Windows имена входа SQL Server не отключаются. Specifying Windows authentication does not disable SQL Server logins. Чтобы отключить имена входа SQL Server с правами доступа, используйте инструкцию Transact-SQL ALTER LOGIN DISABLE. Use the ALTER LOGIN DISABLE Transact-SQL statement to disable highly-privileged SQL Server logins.
Типы имен входа Login Types
В SQL Server существует три типа имен входа. SQL Server supports three types of logins:
Локальная учетная запись пользователя Windows или доверенная учетная запись домена. A local Windows user account or trusted domain account. SQL Server доверяет проверку подлинности учетных записей пользователей Windows самой системе Windows. SQL Server relies on Windows to authenticate the Windows user accounts.
Группа Windows. Windows group. Предоставление доступа группе Windows обеспечивает доступ ко всем именам входа пользователей Windows, которые являются членами группы. Granting access to a Windows group grants access to all Windows user logins that are members of the group.
Имя входа SQL Server. SQL Server login. SQL Server хранит в базе данных master имя пользователя и хэш пароля путем использования внутренних методов проверки подлинности при попытке входа в базу данных. SQL Server stores both the username and a hash of the password in the master database, by using internal authentication methods to verify login attempts.
SQL Server предоставляет имена входа, созданные из сертификатов или асимметричных ключей, которые используются только для подписывания кода. SQL Server provides logins created from certificates or asymmetric keys that are used only for code signing. Они не могут использоваться для подключения к SQL Server. They cannot be used to connect to SQL Server.
Режим смешанной проверки подлинности Mixed Mode Authentication
При необходимости использовать режим смешанной проверки подлинности следует создать имена входа SQL Server, которые хранятся в SQL Server. If you must use mixed mode authentication, you must create SQL Server logins, which are stored in SQL Server. Затем имя пользователя и пароль SQL Server нужно будет вводить во время выполнения. You then have to supply the SQL Server user name and password at run time.
SQL Server устанавливается с логином SQL Server с именем sa . (сокращение от «system administrator»). SQL Server installs with a SQL Server login named sa (an abbreviation of «system administrator»). Назначьте надежный пароль для имени входа sa и не используйте имя входа sa в вашем приложении. Assign a strong password to the sa login and do not use the sa login in your application. Карты входа sa на фиксированную серверную роль sysadmin , которая имеет безотзывные административные учетные данные на всем сервере. The sa login maps to the sysadmin fixed server role, which has irrevocable administrative credentials on the whole server. Нет никаких ограничений на потенциальный ущерб, если злоумышленник получит доступ в качестве системного администратора. There are no limits to the potential damage if an attacker gains access as a system administrator. Все члены группы Windows BUILTIN\Administrators (группы локального администратора) по умолчанию являются членами роли sysadmin , но их можно удалить из этой роли. All members of the Windows BUILTIN\Administrators group (the local administrator’s group) are members of the sysadmin role by default, but can be removed from that role.
SQL Server предоставляет механизмы политики паролей Windows для имен входа SQL Server. SQL Server provides Windows password policy mechanisms for SQL Server logins. Политика сложности паролей позволяет отражать атаки, использующие простой перебор, путем увеличения числа возможных паролей. Password complexity policies are designed to deter brute force attacks by increasing the number of possible passwords. SQL Server могут применять те же политики сложности и срока действия к паролям, которые используются в SQL Server. SQL Server can apply the same complexity and expiration policies to passwords used inside SQL Server.
Сосредоточение строк соединения из пользовательского ввода может сделать ваш сервер уязвимым к атаке путем внедрения строки подключения. Concatenating connection strings from user input can leave you vulnerable to a connection string injection attack. Используйте SqlConnectionStringBuilder для создания синтаксически корректных строк подключения во время выполнения. Use the SqlConnectionStringBuilder to create syntactically valid connection strings at run time. Дополнительные сведения см. в статье Connection String Builders (Построители строк подключения). For more information, see Connection String Builders.
Внешние ресурсы External Resources
Для получения дополнительных сведений см. следующие ресурсы. For more information, see the following resources.
Sql server 2008 windows auth with username and password
The following forum(s) have migrated to Microsoft Q&A: All English SQL Server forums!
Visit Microsoft Q&A to post new questions.
Answered by:
Question
iam using SqlServer 2008r2 and my pc is in the network (in an office)
how can change my login password which is created in SQl server authentication?
Answers
- 1. Login into SQL server using Windows Authentication.
- 2. In Object Explorer, open Security folder, open Logins folder. Right Click on sa account and go to Properties.
- 3. Type a new SQL LOGIN password, and confirm it. Click OK to finish.
From A query Window you can try this
- Step 1. Open SQL Server Management Studio
- Step 2. Open a new query
- Step 3. Type the follow commands and excute:
GO
ALTER LOGIN [LOGIN_NAME] WITH DEFAULT_DATABASE=[master]
GO
USE [master]
GO
ALTER LOGIN [LOGIN_NAME] WITH PASSWORD=N’NewPassword’ MUST_CHANGE
GO
Hope this helps you
- 1. Login into SQL server using Windows Authentication.
2. In Object Explorer, open Security folder, open Logins folder. Right Click on sa account and go to Properties.
3. Type a new SQL sa password, and confirm it. Click OK to finish.
After restarting SQL Server and all its services, you can log into SQL Server by sa login with new SQL sa password.
To chainge through Query Analyser
- Change SQL Server Password with the Query Windows in Management Studio
Step 1. Open SQL Server Management Studio
Step 2. Open a new query
Step 3. Type the follow commands and excute:
GO
ALTER LOGIN [sa] WITH DEFAULT_DATABASE=[master]
GO
USE [master]
GO
ALTER LOGIN [sa] WITH PASSWORD=N’NewPassword’ MUST_CHANGE
GO
Then the new password is set for your SQL Server sa account.
Please click the Mark as Answer or Vote As Helpful button if a post solves your problem or is helpful!
All replies
- 1. Login into SQL server using Windows Authentication.
- 2. In Object Explorer, open Security folder, open Logins folder. Right Click on sa account and go to Properties.
- 3. Type a new SQL LOGIN password, and confirm it. Click OK to finish.
From A query Window you can try this
- Step 1. Open SQL Server Management Studio
- Step 2. Open a new query
- Step 3. Type the follow commands and excute:
GO
ALTER LOGIN [LOGIN_NAME] WITH DEFAULT_DATABASE=[master]
GO
USE [master]
GO
ALTER LOGIN [LOGIN_NAME] WITH PASSWORD=N’NewPassword’ MUST_CHANGE
GO
Hope this helps you
- 1. Login into SQL server using Windows Authentication.
2. In Object Explorer, open Security folder, open Logins folder. Right Click on sa account and go to Properties.
3. Type a new SQL sa password, and confirm it. Click OK to finish.
After restarting SQL Server and all its services, you can log into SQL Server by sa login with new SQL sa password.
To chainge through Query Analyser
- Change SQL Server Password with the Query Windows in Management Studio
Step 1. Open SQL Server Management Studio
Step 2. Open a new query
Step 3. Type the follow commands and excute:
GO
ALTER LOGIN [sa] WITH DEFAULT_DATABASE=[master]
GO
USE [master]
GO
ALTER LOGIN [sa] WITH PASSWORD=N’NewPassword’ MUST_CHANGE
GO
Then the new password is set for your SQL Server sa account.
Please click the Mark as Answer or Vote As Helpful button if a post solves your problem or is helpful!
To change sql server 2008 password by the following methods.
Method 1: Change SA password SQL server 2008 by Windows Authentication
If Built-in/Administrator is present in SQL 2008 Server, you can login with an ID which is member of Administrators group and reset SA password in SQL Server. Just do as follows:
Step 1. Login into SQL 2008 server using Windows Authentication.
Step 2. In Object Explorer, open Security folder, open Logins folder. Right click on sa account and go to Properties.
Step 3. Type a new SQL SA password, and confirm it. Click OK to finish.
Method 2: changeSQL server 2008 password with Smartkey SQL Password Recovery
Step 1: Download SQL server 2008 password reset software and install it on your computer.
Step 2: Run the software, when see the interface, click Open to load the master .mdf file. All the user names of your SQL Server will be displayed.
Step 3: Select the password forgotten account, here the forgotten password account is SA, select it.
Step 4: Click “Change Password” button, then choose the new password in the “Change Password” panel, and then click OK to finish modification.