{"id":4456,"date":"2012-07-12T15:50:03","date_gmt":"2012-07-12T07:50:03","guid":{"rendered":"http:\/\/www.sharepointboost.com\/blog\/?p=4456"},"modified":"2023-07-31T11:39:28","modified_gmt":"2023-07-31T03:39:28","slug":"sharepoint-access-denied-error-when-recreating-user-id-in-ad","status":"publish","type":"post","link":"https:\/\/www.boostsolutions.com\/blog\/sharepoint-access-denied-error-when-recreating-user-id-in-ad\/","title":{"rendered":"SharePoint &#8220;Access Denied&#8221; Error when Recreating User ID in AD"},"content":{"rendered":"<p>Recently I discovered an interesting thing about SharePoint user management, reusing SharePoint user IDs results in an &#8220;<strong>Access Denied&#8221;<\/strong> error.<\/p>\n<p><span style=\"text-decoration: underline;\">This can be replicated using following steps<\/span>:<\/p>\n<ol>\n<li>Have user &#8220;<strong>A<\/strong>&#8221; as a SharePoint user.<\/li>\n<li>Delete user &#8220;<strong>A<\/strong>&#8221; from site collection.<\/li>\n<li>Delete user &#8220;<strong>A<\/strong>&#8221; from Active Directory.<\/li>\n<li>Create a new account in AD with the same user &#8220;<strong>A&#8221;<\/strong> name.<\/li>\n<li>Add user &#8220;<strong>A<\/strong>&#8221; back to SharePoint.<\/li>\n<\/ol>\n<p>When logging into SharePoint using <strong>A&#8217;<\/strong>s account, results in an &#8220;<strong>Access Denied<\/strong>&#8221; error. After refreshing AD, restarting IIS, user <strong>A&#8217;<\/strong>s is still access denied.<\/p>\n<p><strong><span style=\"text-decoration: underline;\">Analysis ? I ran a complete test to see what was actually going on<\/span><\/strong>:<\/p>\n<p>1. First, I add user &#8220;<strong>DeleteUser<\/strong>&#8221; to a site collection, then I go to Content Database of site collection and open the UserInfo table.<\/p>\n<p><a href=\"http:\/\/www.BoostSolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-1SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-4458\" title=\"Pic 1SharePoint Access Denied Error when Recreating User ID in AD\" src=\"http:\/\/www.BoostSolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-1SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD.jpg\" alt=\"\" width=\"1453\" height=\"157\" srcset=\"https:\/\/www.boostsolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-1SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD.jpg 1453w, https:\/\/www.boostsolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-1SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD-300x32.jpg 300w, https:\/\/www.boostsolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-1SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD-1024x110.jpg 1024w\" sizes=\"(max-width: 1453px) 100vw, 1453px\" \/><\/a><\/p>\n<p><!--more-->2. I then delete &#8220;<strong>DeleteUser<\/strong>&#8221; from the site collection.<\/p>\n<p>3. I check database again and find that the <strong>tp_Deleted<\/strong> column is set to the user&#8217;s ID, <strong>tp_IsActive<\/strong> column is set to <strong>0<\/strong> and <strong>tp_Token<\/strong> is set to <strong>NULL<\/strong>.<\/p>\n<p><a href=\"http:\/\/www.BoostSolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-2SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-4461\" title=\"Pic 2SharePoint Access Denied Error when Recreating User ID in AD\" src=\"http:\/\/www.BoostSolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-2SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD.jpg\" alt=\"\" width=\"807\" height=\"86\" srcset=\"https:\/\/www.boostsolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-2SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD.jpg 807w, https:\/\/www.boostsolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-2SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD-300x31.jpg 300w\" sizes=\"(max-width: 807px) 100vw, 807px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/www.BoostSolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-3SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><\/a>4. Everything is normal till now, but then I add a new &#8220;<strong>DeleteUser<\/strong>&#8221; in AD and add it back to SharePoint.<\/p>\n<p>5. However, we can see &#8220;<strong>DeleteUser<\/strong>&#8221; is back with the same data as it had before being deleted.<\/p>\n<p><a href=\"http:\/\/www.BoostSolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-3SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD1.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-4460\" title=\"Pic 3SharePoint Access Denied Error when Recreating User ID in AD\" src=\"http:\/\/www.BoostSolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-3SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD1.jpg\" alt=\"\" width=\"1357\" height=\"151\" srcset=\"https:\/\/www.boostsolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-3SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD1.jpg 1357w, https:\/\/www.boostsolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-3SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD1-300x33.jpg 300w, https:\/\/www.boostsolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-3SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD1-1024x113.jpg 1024w\" sizes=\"(max-width: 1357px) 100vw, 1357px\" \/><\/a><\/p>\n<p><strong><span style=\"text-decoration: underline;\">The Issue<\/span><\/strong>:<\/p>\n<p>The reused &#8220;<strong>DeleteUser<\/strong>&#8221; account can no longer access the SharePoint site! If we check the column <strong>tp_SystemID<\/strong> for which SID is being used in SharePoint, we find that this SID has not been changed. This is the explanation given by Microsoft: &#8220;when you added the user information to SharePoint, SharePoint updated the user&#8217;s existing entry in the <strong>UserInfo<\/strong> table instead of creating a new entry. However, the user security identifier (SID) in the old entry is no longer correct.&#8221; (please refer to <a href=\"http:\/\/support.microsoft.com\/kb\/982949\">kb982949<\/a>)<\/p>\n<p><strong><span style=\"text-decoration: underline;\">Resolution<\/span><\/strong>:<\/p>\n<p>I resolved the issue by deleting the &#8220;<strong>DeleteUser<\/strong>&#8221; entry in database and added this user again in SharePoint. However, this is not a very good way, as I have to reassign user&#8217;s permissions.<\/p>\n<p><strong><span style=\"text-decoration: underline;\">The right way is SharePoint 2010 Management Shell<\/span><\/strong>:<\/p>\n<p>1. On the server that is running SharePoint, open Management Shell and type the following command<\/p>\n<p><strong> <\/strong><\/p>\n<p><strong>stsadm.exe -o migrateuser -oldlogin Domainname\\OldUserName -newlogin Domainname\\NewUserName ?ignoresidhistory<\/strong><\/p>\n<p><strong> <\/strong>2. Press the &#8220;<strong>Enter<\/strong>&#8221; button.<\/p>\n<p><a href=\"http:\/\/www.BoostSolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-4SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-4462\" title=\"Pic 4SharePoint Access Denied Error when Recreating User ID in AD\" src=\"http:\/\/www.BoostSolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-4SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD.jpg\" alt=\"\" width=\"682\" height=\"208\" srcset=\"https:\/\/www.boostsolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-4SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD.jpg 682w, https:\/\/www.boostsolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-4SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD-300x91.jpg 300w\" sizes=\"(max-width: 682px) 100vw, 682px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/www.BoostSolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-4SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><\/a>3. After running the command, the database entry <strong>tp_SystemID<\/strong> changed and <strong>DeleteUser<\/strong> can once again logon.<\/p>\n<p><a href=\"http:\/\/www.BoostSolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-5SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-4463\" title=\"Pic 5SharePoint Access Denied Error when Recreating User ID in AD\" src=\"http:\/\/www.BoostSolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-5SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD.jpg\" alt=\"\" width=\"1349\" height=\"158\" srcset=\"https:\/\/www.boostsolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-5SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD.jpg 1349w, https:\/\/www.boostsolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-5SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD-300x35.jpg 300w, https:\/\/www.boostsolutions.com\/blog\/wp-content\/uploads\/2012\/07\/Pic-5SharePoint-Access-Denied-Error-when-Recreating-User-ID-in-AD-1024x119.jpg 1024w\" sizes=\"(max-width: 1349px) 100vw, 1349px\" \/><\/a><\/p>\n<p><strong><span style=\"text-decoration: underline;\">Note<\/span><\/strong>: Run this command only from user accounts that are in the same domain. Otherwise, you may experience other permission problems. This command automatically updates the account name and the command maintains the appropriate permissions for the account.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently I discovered an interesting thing about SharePoint user management, reusing SharePoint user IDs results in an &#8220;Access Denied&#8221; error. This can be replicated using following steps: Have user &#8220;A&#8221; as a SharePoint user. Delete user &#8220;A&#8221; from site collection. Delete user &#8220;A&#8221; from Active Directory. Create a new account in AD with the same [&hellip;]<\/p>\n","protected":false},"author":22,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[125],"tags":[425,424,426],"_links":{"self":[{"href":"https:\/\/www.boostsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4456"}],"collection":[{"href":"https:\/\/www.boostsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.boostsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.boostsolutions.com\/blog\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.boostsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=4456"}],"version-history":[{"count":5,"href":"https:\/\/www.boostsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4456\/revisions"}],"predecessor-version":[{"id":9207,"href":"https:\/\/www.boostsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4456\/revisions\/9207"}],"wp:attachment":[{"href":"https:\/\/www.boostsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=4456"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.boostsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=4456"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.boostsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=4456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}