收回权限
不使用 -p
指定vhost时,默认会使用 /
,而不是清除所有
[root@h102 ~]# rabbitmqctl list_user_permissions mq
Listing permissions for user "mq" ...
/ ^mq.* .* .*
mq_test .* .* .*
[root@h102 ~]# rabbitmqctl clear_permissions -p / mq
Clearing permissions for user "mq" in vhost "/" ...
[root@h102 ~]# rabbitmqctl list_permissions -p /
Listing permissions in vhost "/" ...
guest .* .* .*
[root@h102 ~]# rabbitmqctl list_permissions -p mq_test
Listing permissions in vhost "mq_test" ...
mq .* .* .*
[root@h102 ~]# rabbitmqctl list_user_permissions mq
Listing permissions for user "mq" ...
mq_test .* .* .*
[root@h102 ~]# rabbitmqctl clear_permissions mq
Clearing permissions for user "mq" in vhost "/" ...
[root@h102 ~]# rabbitmqctl list_user_permissions mq
Listing permissions for user "mq" ...
mq_test .* .* .*
[root@h102 ~]#
删除vhost
最彻底直接方便也是最危险的权限清除方式就是直接删掉vhost
代码语言:javascript复制[root@h102 ~]# rabbitmqctl list_vhosts
Listing vhosts ...
/
/abc
mq_test
[root@h102 ~]# rabbitmqctl delete_vhost mq_test
Deleting vhost "mq_test" ...
[root@h102 ~]# rabbitmqctl list_vhosts
Listing vhosts ...
/
/abc
[root@h102 ~]# rabbitmqctl list_user_permissions mq
Listing permissions for user "mq" ...
[root@h102 ~]#