VMware ESXi5忘记登录密码解决办法
很久没有登录ESXi5了,今天登录发现忘记密码了:
网上搜索到的方法都是使用linux其他版本的镜像的恢复模式来重置密码(尝试过了,ESXI自己的镜像没有恢复模式)。于是使用现有的Ubuntu镜像来操作。
1、挂载Ubuntu镜像,然后以cd方式启动虚拟机
2、按F5进入恢复模式
3、选择try Ubuntu
4、打开终端,exsi默认的存储在/dev/sda5中,在当前目录新建文件夹/sda然后把/dev/sda5挂载进去
mkdir ./sda mount /dev/sda5 ./sda
5、进入sda文件夹中,拷贝state.tgz到tmp文件夹,然后解压进入etc目录找到密码文件
cp /sda/state.tgz /tmp tar xvf state.tgz 得到local.tgz tar xvf local.tgz得到etc文件夹
6、编辑shadow密码文件,把root列中的密码去掉,就是把第一个和第二个冒号之间的内容删除掉,然后保存退出。
7、重新压缩etc文件夹成local.tgz和state.tgz文件,放进sda文件夹中
tar czf local.tgz etc/ tar czf state.tgz local.tgz cp state.tgz /sda/
8、卸载/dev/sda5,完成重启即可。
sudo unmount /dev/sda5
附录:
ESXI5的密码设置规则:https://communities.vmware.com/docs/DOC-31941
The password policy in ESXi 6 has following requirements:
- Passwords must contain characters from at least three character classes.
- Passwords containing characters from three character classes must be at least seven characters long.
- Passwords containing characters from all four character classes must be at least seven characters long.
- An uppercase character that begins a password does not count toward the number of character classes used.
- A number that ends a password does not count toward the number of character classes used.
- The password cannot contain a dictionary word or part of a dictionary word.
个人工作学习笔记,如有错误,欢迎指正。