Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Login account locked

Author  Topic 

prodigy2006
Yak Posting Veteran

66 Posts

Posted - 2009-09-28 : 17:03:36
Could anyone please explain the process to unlock a SQL Server login account?

Thanks,
Sunny

prodigy2006
Yak Posting Veteran

66 Posts

Posted - 2009-09-29 : 10:44:29
Could anybody please reply to this post.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-09-29 : 11:18:55
Did you look in Books Online under "ALTER LOGIN"?
Go to Top of Page

prodigy2006
Yak Posting Veteran

66 Posts

Posted - 2009-09-29 : 12:40:58
I'm little confused here, is there a way to unlock a login without giving the password in the below Alter Login statement?

Alter login <loginname> with password=<passwood> unlock.

quote:
Originally posted by robvolk

Did you look in Books Online under "ALTER LOGIN"?

Go to Top of Page

tripodal
Constraint Violating Yak Guru

259 Posts

Posted - 2009-09-29 : 17:11:37
You are specifying the new password.

Assuming you have correct permissions you will not have a problem.

BOL quote
quote:

Requires ALTER ANY LOGIN permission.

If the CREDENTIAL option is used, also requires ALTER ANY CREDENTIAL permission.

If the login that is being altered is a grantee of CONTROL SERVER permission, also requires CONTROL SERVER permission when making the following changes:

Resetting the password without supplying the old password.



Enabling MUST_CHANGE, CHECK_POLICY, or CHECK_EXPIRATION.


Changing the login name.


Enabling or disabling the login.


Mapping the login to a different credential.


A principal can change the password, default language, and default database for its own login.

Go to Top of Page

prodigy2006
Yak Posting Veteran

66 Posts

Posted - 2009-09-29 : 18:37:36
I want to unlock the developer's login without changing the password.
Will the below statement work:

Alter login <loginname> unlock
Go to Top of Page

mcrowley
Aged Yak Warrior

771 Posts

Posted - 2009-09-30 : 11:42:32
nope. You need the password. Tell the developer to be more careful about locking himself out.
Go to Top of Page

jeffw8713
Aged Yak Warrior

819 Posts

Posted - 2009-09-30 : 18:16:14
If you really have to keep the password the same, then you can save the encrypted password value, unlock the account and change the password to a dummy string, then alter the login and change the password using the encrypted string.

-- First step is to get our hashed password value
SELECT cast(loginproperty('LoginNameHere', 'PasswordHash') As varbinary(256));

-- Save the above value somewhere, then unlock the account
ALTER LOGIN LoginNameHere WITH PASSWORD = 'DummyPasswordHere' UNLOCK;

-- Now, modify the login and reset the password with the old password
ALTER LOGIN LoginNameHere WITH PASSWORD = HashedPasswordHere HASHED;


Go to Top of Page
   

- Advertisement -