MacOS上的虚拟机软件用的Parallels Desktop,虚拟机也就偶尔开一下,设置的密码经常忘记,导致经常打开后要重置密码。本文介绍一个重置parallels desktop虚拟机密码的脚本,让你摆脱忘记密码的烦恼,方便实用。:
#!/bin/bash
# reset passowrd of parallels desktop VMs
#author tlanyan<tlanyan@hotmail.com>
prlctl list -a
machines=`prlctl list -a|sed '1d'`
count=`echo "$machines"|wc -l`
((count--))
read -p "please select vm index[0-$count]:" index
if [ $index -gt $count ]; then
echo "invlid choice!"
exit
fi
((index++))
line=`echo "$machines" | sed -n ${index}p`
echo your choice: $line
id=`echo "$line" | tr '{}' ' ' | awk '{print $1}'`
read -p "please input username:" username
read -p "release input password:" password
prlctl set $id --userpasswd $username:$password
发表回复