etcd 添加用戶,授權特定目錄


適用場景

多組共用etcd集群,創建一個新用戶、新目錄,讓這個新用戶只有新目錄的使用權限。

命令和順序
創建目錄,注意此處是v2
curl -u root:pwd  http://host:2379/v2/keys/dir -XPUT -d dir=true

查看用戶列表
./etcdctl -u root:pwd --endpoints=http://host:2379 user list

添加用戶
./etcdctl -u root:pwd --endpoints=http://host:2379 user list

查看角色列表
./etcdctl -u root:pwd --endpoints=http://host:2379 role list

添加角色
./etcdctl -u root:pwd --endpoints=http://host:2379 role add systech_nsq

賦予角色指定目錄權限
./etcdctl -u root:pwd --endpoints=http://host:2379 role grant systech_nsq -path '/b2c_systech_nsq/*' -readwrite

查看角色權限
./etcdctl -u root:pwd --endpoints=http://host:2379 role get systech_nsq

賦予用戶角色
./etcdctl -u root:pwd --endpoints=http://host:2379 user grant systech_nsq -roles systech_nsq


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM