maven私服nexus忘记密码,解决方法

1、vi data/db/security/user.pcl

2、找到这个地方:adminZAdministratorHUser[email protected]<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-2.14.2-01 目录为程序路径,里面有 logs、bin、conf、tmp 等目录 
sonatype-work   目录为Maven仓库路径  


nexus-2.14.2-01 目录为程序路径,里面有 logs、bin、conf、tmp 等目录 
sonatype-work   目录为Maven仓库路径

(2)在Maven仓库路径下有一个文件security.xml,文件中有用户和密码以及权限的分配:

	sonatype-work/nexus/conf/security.xml
	sonatype-work/nexus/conf/security.xml
	<?xml version="1.0" encoding="UTF-8"?>
	<security>
	  <version>2.0.5</version>
	  <users>
	    <user>
	      <id>deployment</id>
	      <firstName>Deployment</firstName>
	      <lastName>User</lastName>
	      <password>b2a0e378437817cebdf753d7dff3dd75483af9e0</password>
	      <status>active</status>
	      <email>[email protected]</email>
	    </user>
	    <user>
	      <id>anonymous</id>
	      <firstName>Nexus</firstName>
	      <lastName>Anonymous User</lastName>
	      <password>$shiro1$SHA-512$1024$Q82OUH8KmDZZrXTOpZY+lg==$Tsscq7Su4ZZDtUV9cKrAbJK7UIMFtxRdN/UUDBpJtdRegcIWUEAEqbYarhKm7znytB8X8Mlu68dc82IHqUBX/g==</password>
	      <status>active</status>
	      <email>[email protected]</email>
	    </user>
	    <user>
	      <id>admin</id>
	      <firstName>Administrator</firstName>
	      <lastName>User</lastName>
	      <password>$shiro1$SHA-512$1024$PWSCGOcz9yPs7g7d6gkAcQ==$m1hRsx948wkmFtyb/d/brugEgPIt88dz7UlvqXiiI9d5sTRwPX7VCyljEz34Uxl3nQ+Y7KCESnsJkpSt9DnHZg==</password>
	      <status>active</status>
	      <email>[email protected]</email>
	    </user>
	    <user>
	      <id>root</id>
	      <firstName>root</firstName>
	      <lastName>root</lastName>
	      <password>$shiro1$SHA-512$1024$d9ZrWi5Pu9XT0E2CTia1kQ==$cGhEosVMqVxfqZCfV9ZXax6o/fGzWvt1LXnB5qiCbhJFnL1r7BSpVsHKncc3FoKb/KjQvuYEnqtT/wWkYEvtyA==</password>
	      <status>active</status>
	      <email>[email protected]</email>
	    </user>
	  </users>
	  <userRoleMappings>
	    <userRoleMapping>
	      <userId>deployment</userId>
	      <source>default</source>
	      <roles>
	        <role>nx-deployment</role>
	        <role>repository-any-full</role>
	      </roles>
	    </userRoleMapping>
	    <userRoleMapping>
	      <userId>anonymous</userId>
	      <source>default</source>
	      <roles>
	        <role>anonymous</role>
	        <role>repository-any-read</role>
	      </roles>
	    </userRoleMapping>
	    <userRoleMapping>
	      <userId>admin</userId>
	      <source>default</source>
	      <roles>
	        <role>nx-admin</role>
	      </roles>
	    </userRoleMapping>
	    <userRoleMapping>
	      <userId>root</userId>
	      <source>default</source>
	      <roles>
	        <role>nx-deployment</role>
	        <role>repository-any-full</role>
	      </roles>
	    </userRoleMapping>
	  </userRoleMappings>
	</security>
	<?xml version="1.0" encoding="UTF-8"?>
	<security>
	  <version>2.0.5</version>
	  <users>
	    <user>
	      <id>deployment</id>
	      <firstName>Deployment</firstName>
	      <lastName>User</lastName>
	      <password>b2a0e378437817cebdf753d7dff3dd75483af9e0</password>
	      <status>active</status>
	      <email>[email protected]</email>
	    </user>
	    <user>
	      <id>anonymous</id>
	      <firstName>Nexus</firstName>
	      <lastName>Anonymous User</lastName>
	      <password>$shiro1$SHA-512$1024$Q82OUH8KmDZZrXTOpZY+lg==$Tsscq7Su4ZZDtUV9cKrAbJK7UIMFtxRdN/UUDBpJtdRegcIWUEAEqbYarhKm7znytB8X8Mlu68dc82IHqUBX/g==</password>
	      <status>active</status>
	      <email>[email protected]</email>
	    </user>
	    <user>
	      <id>admin</id>
	      <firstName>Administrator</firstName>
	      <lastName>User</lastName>
	      <password>$shiro1$SHA-512$1024$PWSCGOcz9yPs7g7d6gkAcQ==$m1hRsx948wkmFtyb/d/brugEgPIt88dz7UlvqXiiI9d5sTRwPX7VCyljEz34Uxl3nQ+Y7KCESnsJkpSt9DnHZg==</password>
	      <status>active</status>
	      <email>[email protected]</email>
	    </user>
	    <user>
	      <id>root</id>
	      <firstName>root</firstName>
	      <lastName>root</lastName>
	      <password>$shiro1$SHA-512$1024$d9ZrWi5Pu9XT0E2CTia1kQ==$cGhEosVMqVxfqZCfV9ZXax6o/fGzWvt1LXnB5qiCbhJFnL1r7BSpVsHKncc3FoKb/KjQvuYEnqtT/wWkYEvtyA==</password>
	      <status>active</status>
	      <email>[email protected]</email>
	    </user>
	  </users>
	  <userRoleMappings>
	    <userRoleMapping>
	      <userId>deployment</userId>
	      <source>default</source>
	      <roles>
	        <role>nx-deployment</role>
	        <role>repository-any-full</role>
	      </roles>
	    </userRoleMapping>
	    <userRoleMapping>
	      <userId>anonymous</userId>
	      <source>default</source>
	      <roles>
	        <role>anonymous</role>
	        <role>repository-any-read</role>
	      </roles>
	    </userRoleMapping>
	    <userRoleMapping>
	      <userId>admin</userId>
	      <source>default</source>
	      <roles>
	        <role>nx-admin</role>
	      </roles>
	    </userRoleMapping>
	    <userRoleMapping>
	      <userId>root</userId>
	      <source>default</source>
	      <roles>
	        <role>nx-deployment</role>
	        <role>repository-any-full</role>
	      </roles>
	    </userRoleMapping>
	  </userRoleMappings>
	</security>
  • 将忘记密码的用户的password节点信息用f865b53623b121fd34ee5426c792e5c33af8c227字符串替换,这样密码就重置为admin123;
  • 找到nexus的程序路径nexus的bin目录,重启nexus服务./nexus restart,重启完成之后admin用户的密码就重置成了admin123了;

你可能感兴趣的:(maven)