1、vi data/db/security/user.pcl
2、找到这个地方:adminZAdministratorHUserLactive&tianya@zifangdt.com<8c>B s h i r o 1 shiro1 shiro1SHA-512 1024 1024 1024NE+wqQq/TmjZMvfI7ENh/g==$V4yPw8T64UQ6GfJfxYq2hLsVrBY8D1v+bktfOxGdt4b/9BthpWPNUy/CBk6V9iA0nHpzYzJFWO8v/tZFtES8CA==
将1024后面的131个字符删除掉,然后用上述131个字符替换
3、重启nexus3 ,admin密码恢复为admin123
————————————————
版权声明:本文为CSDN博主「Jason_Ptcc」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/tianya6607/article/details/53305620
方式一:
(1)找到nexus的程序路径和Maven仓库路径:
nexus<span class="hljs-subst">-</span><span class="hljs-number">2.14</span><span class="hljs-number">.2</span><span class="hljs-subst">-</span><span class="hljs-number">01</span> 目录为程序路径,里面有 logs、bin、conf、tmp 等目录
sonatype<span class="hljs-attribute">-work</span> 目录为Maven仓库路径
nexus<span class="hljs-subst">-</span><span class="hljs-number">2.14</span><span class="hljs-number">.2</span><span class="hljs-subst">-</span><span class="hljs-number">01</span> 目录为程序路径,里面有 logs、bin、conf、tmp 等目录
sonatype<span class="hljs-attribute">-work</span> 目录为Maven仓库路径
(2)在Maven仓库路径下有一个文件security.xml,文件中有用户和密码以及权限的分配:
sonatype<span class="hljs-attribute">-work</span>/nexus/conf/security<span class="hljs-built_in">.</span><span class="hljs-built_in">xml</span>
sonatype<span class="hljs-attribute">-work</span>/nexus/conf/security<span class="hljs-built_in">.</span><span class="hljs-built_in">xml</span>
<span class="hljs-pi"><?xml version="1.0" encoding="UTF-8"?></span>
<span class="hljs-tag"><<span class="hljs-title">security</span>></span>
<span class="hljs-tag"><<span class="hljs-title">version</span>></span>2.0.5<span class="hljs-tag"></<span class="hljs-title">version</span>></span>
<span class="hljs-tag"><<span class="hljs-title">users</span>></span>
<span class="hljs-tag"><<span class="hljs-title">user</span>></span>
<span class="hljs-tag"><<span class="hljs-title">id</span>></span>deployment<span class="hljs-tag"></<span class="hljs-title">id</span>></span>
<span class="hljs-tag"><<span class="hljs-title">firstName</span>></span>Deployment<span class="hljs-tag"></<span class="hljs-title">firstName</span>></span>
<span class="hljs-tag"><<span class="hljs-title">lastName</span>></span>User<span class="hljs-tag"></<span class="hljs-title">lastName</span>></span>
<span class="hljs-tag"><<span class="hljs-title">password</span>></span>b2a0e378437817cebdf753d7dff3dd75483af9e0<span class="hljs-tag"></<span class="hljs-title">password</span>></span>
<span class="hljs-tag"><<span class="hljs-title">status</span>></span>active<span class="hljs-tag"></<span class="hljs-title">status</span>></span>
<span class="hljs-tag"><<span class="hljs-title">email</span>></span>changeme1@yourcompany.com<span class="hljs-tag"></<span class="hljs-title">email</span>></span>
<span class="hljs-tag"></<span class="hljs-title">user</span>></span>
<span class="hljs-tag"><<span class="hljs-title">user</span>></span>
<span class="hljs-tag"><<span class="hljs-title">id</span>></span>anonymous<span class="hljs-tag"></<span class="hljs-title">id</span>></span>
<span class="hljs-tag"><<span class="hljs-title">firstName</span>></span>Nexus<span class="hljs-tag"></<span class="hljs-title">firstName</span>></span>
<span class="hljs-tag"><<span class="hljs-title">lastName</span>></span>Anonymous User<span class="hljs-tag"></<span class="hljs-title">lastName</span>></span>
<span class="hljs-tag"><<span class="hljs-title">password</span>></span>$shiro1$SHA-512$1024$Q82OUH8KmDZZrXTOpZY+lg==$Tsscq7Su4ZZDtUV9cKrAbJK7UIMFtxRdN/UUDBpJtdRegcIWUEAEqbYarhKm7znytB8X8Mlu68dc82IHqUBX/g==<span class="hljs-tag"></<span class="hljs-title">password</span>></span>
<span class="hljs-tag"><<span class="hljs-title">status</span>></span>active<span class="hljs-tag"></<span class="hljs-title">status</span>></span>
<span class="hljs-tag"><<span class="hljs-title">email</span>></span>changeme2@yourcompany.com<span class="hljs-tag"></<span class="hljs-title">email</span>></span>
<span class="hljs-tag"></<span class="hljs-title">user</span>></span>
<span class="hljs-tag"><<span class="hljs-title">user</span>></span>
<span class="hljs-tag"><<span class="hljs-title">id</span>></span>admin<span class="hljs-tag"></<span class="hljs-title">id</span>></span>
<span class="hljs-tag"><<span class="hljs-title">firstName</span>></span>Administrator<span class="hljs-tag"></<span class="hljs-title">firstName</span>></span>
<span class="hljs-tag"><<span class="hljs-title">lastName</span>></span>User<span class="hljs-tag"></<span class="hljs-title">lastName</span>></span>
<span class="hljs-tag"><<span class="hljs-title">password</span>></span>$shiro1$SHA-512$1024$PWSCGOcz9yPs7g7d6gkAcQ==$m1hRsx948wkmFtyb/d/brugEgPIt88dz7UlvqXiiI9d5sTRwPX7VCyljEz34Uxl3nQ+Y7KCESnsJkpSt9DnHZg==<span class="hljs-tag"></<span class="hljs-title">password</span>></span>
<span class="hljs-tag"><<span class="hljs-title">status</span>></span>active<span class="hljs-tag"></<span class="hljs-title">status</span>></span>
<span class="hljs-tag"><<span class="hljs-title">email</span>></span>changeme@yourcompany.com<span class="hljs-tag"></<span class="hljs-title">email</span>></span>
<span class="hljs-tag"></<span class="hljs-title">user</span>></span>
<span class="hljs-tag"><<span class="hljs-title">user</span>></span>
<span class="hljs-tag"><<span class="hljs-title">id</span>></span>root<span class="hljs-tag"></<span class="hljs-title">id</span>></span>
<span class="hljs-tag"><<span class="hljs-title">firstName</span>></span>root<span class="hljs-tag"></<span class="hljs-title">firstName</span>></span>
<span class="hljs-tag"><<span class="hljs-title">lastName</span>></span>root<span class="hljs-tag"></<span class="hljs-title">lastName</span>></span>
<span class="hljs-tag"><<span class="hljs-title">password</span>></span>$shiro1$SHA-512$1024$d9ZrWi5Pu9XT0E2CTia1kQ==$cGhEosVMqVxfqZCfV9ZXax6o/fGzWvt1LXnB5qiCbhJFnL1r7BSpVsHKncc3FoKb/KjQvuYEnqtT/wWkYEvtyA==<span class="hljs-tag"></<span class="hljs-title">password</span>></span>
<span class="hljs-tag"><<span class="hljs-title">status</span>></span>active<span class="hljs-tag"></<span class="hljs-title">status</span>></span>
<span class="hljs-tag"><<span class="hljs-title">email</span>></span>changeme@yourcompany.com<span class="hljs-tag"></<span class="hljs-title">email</span>></span>
<span class="hljs-tag"></<span class="hljs-title">user</span>></span>
<span class="hljs-tag"></<span class="hljs-title">users</span>></span>
<span class="hljs-tag"><<span class="hljs-title">userRoleMappings</span>></span>
<span class="hljs-tag"><<span class="hljs-title">userRoleMapping</span>></span>
<span class="hljs-tag"><<span class="hljs-title">userId</span>></span>deployment<span class="hljs-tag"></<span class="hljs-title">userId</span>></span>
<span class="hljs-tag"><<span class="hljs-title">source</span>></span>default<span class="hljs-tag"></<span class="hljs-title">source</span>></span>
<span class="hljs-tag"><<span class="hljs-title">roles</span>></span>
<span class="hljs-tag"><<span class="hljs-title">role</span>></span>nx-deployment<span class="hljs-tag"></<span class="hljs-title">role</span>></span>
<span class="hljs-tag"><<span class="hljs-title">role</span>></span>repository-any-full<span class="hljs-tag"></<span class="hljs-title">role</span>></span>
<span class="hljs-tag"></<span class="hljs-title">roles</span>></span>
<span class="hljs-tag"></<span class="hljs-title">userRoleMapping</span>></span>
<span class="hljs-tag"><<span class="hljs-title">userRoleMapping</span>></span>
<span class="hljs-tag"><<span class="hljs-title">userId</span>></span>anonymous<span class="hljs-tag"></<span class="hljs-title">userId</span>></span>
<span class="hljs-tag"><<span class="hljs-title">source</span>></span>default<span class="hljs-tag"></<span class="hljs-title">source</span>></span>
<span class="hljs-tag"><<span class="hljs-title">roles</span>></span>
<span class="hljs-tag"><<span class="hljs-title">role</span>></span>anonymous<span class="hljs-tag"></<span class="hljs-title">role</span>></span>
<span class="hljs-tag"><<span class="hljs-title">role</span>></span>repository-any-read<span class="hljs-tag"></<span class="hljs-title">role</span>></span>
<span class="hljs-tag"></<span class="hljs-title">roles</span>></span>
<span class="hljs-tag"></<span class="hljs-title">userRoleMapping</span>></span>
<span class="hljs-tag"><<span class="hljs-title">userRoleMapping</span>></span>
<span class="hljs-tag"><<span class="hljs-title">userId</span>></span>admin<span class="hljs-tag"></<span class="hljs-title">userId</span>></span>
<span class="hljs-tag"><<span class="hljs-title">source</span>></span>default<span class="hljs-tag"></<span class="hljs-title">source</span>></span>
<span class="hljs-tag"><<span class="hljs-title">roles</span>></span>
<span class="hljs-tag"><<span class="hljs-title">role</span>></span>nx-admin<span class="hljs-tag"></<span class="hljs-title">role</span>></span>
<span class="hljs-tag"></<span class="hljs-title">roles</span>></span>
<span class="hljs-tag"></<span class="hljs-title">userRoleMapping</span>></span>
<span class="hljs-tag"><<span class="hljs-title">userRoleMapping</span>></span>
<span class="hljs-tag"><<span class="hljs-title">userId</span>></span>root<span class="hljs-tag"></<span class="hljs-title">userId</span>></span>
<span class="hljs-tag"><<span class="hljs-title">source</span>></span>default<span class="hljs-tag"></<span class="hljs-title">source</span>></span>
<span class="hljs-tag"><<span class="hljs-title">roles</span>></span>
<span class="hljs-tag"><<span class="hljs-title">role</span>></span>nx-deployment<span class="hljs-tag"></<span class="hljs-title">role</span>></span>
<span class="hljs-tag"><<span class="hljs-title">role</span>></span>repository-any-full<span class="hljs-tag"></<span class="hljs-title">role</span>></span>
<span class="hljs-tag"></<span class="hljs-title">roles</span>></span>
<span class="hljs-tag"></<span class="hljs-title">userRoleMapping</span>></span>
<span class="hljs-tag"></<span class="hljs-title">userRoleMappings</span>></span>
<span class="hljs-tag"></<span class="hljs-title">security</span>></span>
<span class="hljs-pi"><?xml version="1.0" encoding="UTF-8"?></span>
<span class="hljs-tag"><<span class="hljs-title">security</span>></span>
<span class="hljs-tag"><<span class="hljs-title">version</span>></span>2.0.5<span class="hljs-tag"></<span class="hljs-title">version</span>></span>
<span class="hljs-tag"><<span class="hljs-title">users</span>></span>
<span class="hljs-tag"><<span class="hljs-title">user</span>></span>
<span class="hljs-tag"><<span class="hljs-title">id</span>></span>deployment<span class="hljs-tag"></<span class="hljs-title">id</span>></span>
<span class="hljs-tag"><<span class="hljs-title">firstName</span>></span>Deployment<span class="hljs-tag"></<span class="hljs-title">firstName</span>></span>
<span class="hljs-tag"><<span class="hljs-title">lastName</span>></span>User<span class="hljs-tag"></<span class="hljs-title">lastName</span>></span>
<span class="hljs-tag"><<span class="hljs-title">password</span>></span>b2a0e378437817cebdf753d7dff3dd75483af9e0<span class="hljs-tag"></<span class="hljs-title">password</span>></span>
<span class="hljs-tag"><<span class="hljs-title">status</span>></span>active<span class="hljs-tag"></<span class="hljs-title">status</span>></span>
<span class="hljs-tag"><<span class="hljs-title">email</span>></span>changeme1@yourcompany.com<span class="hljs-tag"></<span class="hljs-title">email</span>></span>
<span class="hljs-tag"></<span class="hljs-title">user</span>></span>
<span class="hljs-tag"><<span class="hljs-title">user</span>></span>
<span class="hljs-tag"><<span class="hljs-title">id</span>></span>anonymous<span class="hljs-tag"></<span class="hljs-title">id</span>></span>
<span class="hljs-tag"><<span class="hljs-title">firstName</span>></span>Nexus<span class="hljs-tag"></<span class="hljs-title">firstName</span>></span>
<span class="hljs-tag"><<span class="hljs-title">lastName</span>></span>Anonymous User<span class="hljs-tag"></<span class="hljs-title">lastName</span>></span>
<span class="hljs-tag"><<span class="hljs-title">password</span>></span>$shiro1$SHA-512$1024$Q82OUH8KmDZZrXTOpZY+lg==$Tsscq7Su4ZZDtUV9cKrAbJK7UIMFtxRdN/UUDBpJtdRegcIWUEAEqbYarhKm7znytB8X8Mlu68dc82IHqUBX/g==<span class="hljs-tag"></<span class="hljs-title">password</span>></span>
<span class="hljs-tag"><<span class="hljs-title">status</span>></span>active<span class="hljs-tag"></<span class="hljs-title">status</span>></span>
<span class="hljs-tag"><<span class="hljs-title">email</span>></span>changeme2@yourcompany.com<span class="hljs-tag"></<span class="hljs-title">email</span>></span>
<span class="hljs-tag"></<span class="hljs-title">user</span>></span>
<span class="hljs-tag"><<span class="hljs-title">user</span>></span>
<span class="hljs-tag"><<span class="hljs-title">id</span>></span>admin<span class="hljs-tag"></<span class="hljs-title">id</span>></span>
<span class="hljs-tag"><<span class="hljs-title">firstName</span>></span>Administrator<span class="hljs-tag"></<span class="hljs-title">firstName</span>></span>
<span class="hljs-tag"><<span class="hljs-title">lastName</span>></span>User<span class="hljs-tag"></<span class="hljs-title">lastName</span>></span>
<span class="hljs-tag"><<span class="hljs-title">password</span>></span>$shiro1$SHA-512$1024$PWSCGOcz9yPs7g7d6gkAcQ==$m1hRsx948wkmFtyb/d/brugEgPIt88dz7UlvqXiiI9d5sTRwPX7VCyljEz34Uxl3nQ+Y7KCESnsJkpSt9DnHZg==<span class="hljs-tag"></<span class="hljs-title">password</span>></span>
<span class="hljs-tag"><<span class="hljs-title">status</span>></span>active<span class="hljs-tag"></<span class="hljs-title">status</span>></span>
<span class="hljs-tag"><<span class="hljs-title">email</span>></span>changeme@yourcompany.com<span class="hljs-tag"></<span class="hljs-title">email</span>></span>
<span class="hljs-tag"></<span class="hljs-title">user</span>></span>
<span class="hljs-tag"><<span class="hljs-title">user</span>></span>
<span class="hljs-tag"><<span class="hljs-title">id</span>></span>root<span class="hljs-tag"></<span class="hljs-title">id</span>></span>
<span class="hljs-tag"><<span class="hljs-title">firstName</span>></span>root<span class="hljs-tag"></<span class="hljs-title">firstName</span>></span>
<span class="hljs-tag"><<span class="hljs-title">lastName</span>></span>root<span class="hljs-tag"></<span class="hljs-title">lastName</span>></span>
<span class="hljs-tag"><<span class="hljs-title">password</span>></span>$shiro1$SHA-512$1024$d9ZrWi5Pu9XT0E2CTia1kQ==$cGhEosVMqVxfqZCfV9ZXax6o/fGzWvt1LXnB5qiCbhJFnL1r7BSpVsHKncc3FoKb/KjQvuYEnqtT/wWkYEvtyA==<span class="hljs-tag"></<span class="hljs-title">password</span>></span>
<span class="hljs-tag"><<span class="hljs-title">status</span>></span>active<span class="hljs-tag"></<span class="hljs-title">status</span>></span>
<span class="hljs-tag"><<span class="hljs-title">email</span>></span>changeme@yourcompany.com<span class="hljs-tag"></<span class="hljs-title">email</span>></span>
<span class="hljs-tag"></<span class="hljs-title">user</span>></span>
<span class="hljs-tag"></<span class="hljs-title">users</span>></span>
<span class="hljs-tag"><<span class="hljs-title">userRoleMappings</span>></span>
<span class="hljs-tag"><<span class="hljs-title">userRoleMapping</span>></span>
<span class="hljs-tag"><<span class="hljs-title">userId</span>></span>deployment<span class="hljs-tag"></<span class="hljs-title">userId</span>></span>
<span class="hljs-tag"><<span class="hljs-title">source</span>></span>default<span class="hljs-tag"></<span class="hljs-title">source</span>></span>
<span class="hljs-tag"><<span class="hljs-title">roles</span>></span>
<span class="hljs-tag"><<span class="hljs-title">role</span>></span>nx-deployment<span class="hljs-tag"></<span class="hljs-title">role</span>></span>
<span class="hljs-tag"><<span class="hljs-title">role</span>></span>repository-any-full<span class="hljs-tag"></<span class="hljs-title">role</span>></span>
<span class="hljs-tag"></<span class="hljs-title">roles</span>></span>
<span class="hljs-tag"></<span class="hljs-title">userRoleMapping</span>></span>
<span class="hljs-tag"><<span class="hljs-title">userRoleMapping</span>></span>
<span class="hljs-tag"><<span class="hljs-title">userId</span>></span>anonymous<span class="hljs-tag"></<span class="hljs-title">userId</span>></span>
<span class="hljs-tag"><<span class="hljs-title">source</span>></span>default<span class="hljs-tag"></<span class="hljs-title">source</span>></span>
<span class="hljs-tag"><<span class="hljs-title">roles</span>></span>
<span class="hljs-tag"><<span class="hljs-title">role</span>></span>anonymous<span class="hljs-tag"></<span class="hljs-title">role</span>></span>
<span class="hljs-tag"><<span class="hljs-title">role</span>></span>repository-any-read<span class="hljs-tag"></<span class="hljs-title">role</span>></span>
<span class="hljs-tag"></<span class="hljs-title">roles</span>></span>
<span class="hljs-tag"></<span class="hljs-title">userRoleMapping</span>></span>
<span class="hljs-tag"><<span class="hljs-title">userRoleMapping</span>></span>
<span class="hljs-tag"><<span class="hljs-title">userId</span>></span>admin<span class="hljs-tag"></<span class="hljs-title">userId</span>></span>
<span class="hljs-tag"><<span class="hljs-title">source</span>></span>default<span class="hljs-tag"></<span class="hljs-title">source</span>></span>
<span class="hljs-tag"><<span class="hljs-title">roles</span>></span>
<span class="hljs-tag"><<span class="hljs-title">role</span>></span>nx-admin<span class="hljs-tag"></<span class="hljs-title">role</span>></span>
<span class="hljs-tag"></<span class="hljs-title">roles</span>></span>
<span class="hljs-tag"></<span class="hljs-title">userRoleMapping</span>></span>
<span class="hljs-tag"><<span class="hljs-title">userRoleMapping</span>></span>
<span class="hljs-tag"><<span class="hljs-title">userId</span>></span>root<span class="hljs-tag"></<span class="hljs-title">userId</span>></span>
<span class="hljs-tag"><<span class="hljs-title">source</span>></span>default<span class="hljs-tag"></<span class="hljs-title">source</span>></span>
<span class="hljs-tag"><<span class="hljs-title">roles</span>></span>
<span class="hljs-tag"><<span class="hljs-title">role</span>></span>nx-deployment<span class="hljs-tag"></<span class="hljs-title">role</span>></span>
<span class="hljs-tag"><<span class="hljs-title">role</span>></span>repository-any-full<span class="hljs-tag"></<span class="hljs-title">role</span>></span>
<span class="hljs-tag"></<span class="hljs-title">roles</span>></span>
<span class="hljs-tag"></<span class="hljs-title">userRoleMapping</span>></span>
<span class="hljs-tag"></<span class="hljs-title">userRoleMappings</span>></span>
<span class="hljs-tag"></<span class="hljs-title">security</span>></span>
- 将忘记密码的用户的password节点信息用f865b53623b121fd34ee5426c792e5c33af8c227字符串替换,这样密码就重置为admin123;
- 找到nexus的程序路径nexus的bin目录,重启nexus服务./nexus restart,重启完成之后admin用户的密码就重置成了admin123了;