刚刚开始学习Rancher,前一分钟创建的用户名和密码下一秒就忘了。也是醉了····不过还好可以通过以下方式重新设置,摘自官网的文章http://docs.rancher.com/rancher/faqs/troubleshooting/#help-i-turned-on-access-control-and-can-no-longer-access-rancher-how-do-i-reset-rancher-to-disable-access-control
Authentication
HELP! I TURNED ON ACCESS CONTROL AND CAN NO LONGER ACCESS RANCHER. HOW DO I RESET RANCHER TO DISABLE ACCESS CONTROL?
If something goes wrong with your authentication (like your GitHub authentication getting corrupted), then you may be locked out of Rancher. To re-gain access to Rancher, you’ll need to turn off Access Control in the database. In order to do so, you’ll need access to the machine that is running Rancher Server.
$ docker exec -it <rancher_server_container_ID> mysql
NOTE:
The <rancher_server_container_ID> will be the container that has the Rancher database. If you upgraded and created a Rancher data container, you’ll need to use the ID of the Rancher data container instead of the Rancher server container.
Access the cattle database.
mysql> use cattle;
Review the setting table.
mysql> select * from setting;
Update the api.security.enabled to false. This change will turn off access control and anyone can access Rancher server with the UI/API.
mysql> update setting set value="false" where name="api.security.enabled";
Delete the client ID and secret key for GitHub.
mysql> update setting set value="" where name="api.auth.github.client.id";
mysql> update setting set value="" where name="api.auth.github.client.secret";
Confirm the changes have been made in the setting table.
mysql> select * from setting;
It may take ~1 minute before the authentication will be turned off in the UI, but you will be able to refresh the webpage and access Rancher with access control turned off.
操作完后等一分钟左右再次刷新Rancher server界面就可以了