此内容没有您所选择的语言版本。
Chapter 7. Managing Users
User management functionality provides system administrators with the ability to create, update and delete Red Hat Ceph Storage cluster users.
When you create or delete users in a Red Hat Ceph Storage cluster, you may need to distribute keys to clients so that they can be added to keyrings. See Keyring Management for details.
7.1. List Users 复制链接链接已复制到粘贴板!
To list the users in your cluster, execute the following:
ceph auth list
ceph auth list
Ceph will list out all users in your cluster. For example, in a two-node exemplary cluster, ceph auth list
will output something that looks like this:
Note that the TYPE.ID
notation for users applies such that osd.0
is a user of type osd
and its ID is 0
, client.admin
is a user of type client
and its ID is admin
(i.e., the default client.admin
user). Note also that each entry has a key: <value>
entry, and one or more caps:
entries.
You may use the -o {filename}
option with ceph auth list
to save the output to a file.
7.2. Get a User 复制链接链接已复制到粘贴板!
To retrieve a specific user, key and capabilities, execute the following:
ceph auth get {TYPE.ID}
ceph auth get {TYPE.ID}
For example:
ceph auth get client.admin
ceph auth get client.admin
You may also use the -o {filename}
option with ceph auth get
to save the output to a file. Developers may also execute the following:
ceph auth export {TYPE.ID}
ceph auth export {TYPE.ID}
The auth export
command is identical to auth get
, but also prints out the internal auid
, which isn’t relevant to end users.
7.3. Add a User 复制链接链接已复制到粘贴板!
Adding a user creates a username (i.e., TYPE.ID
), a secret key and any capabilities included in the command you use to create the user.
A user’s key enables the user to authenticate with the Ceph Storage Cluster. The user’s capabilities authorize the user to read, write, or execute on Ceph monitors (mon
), Ceph OSDs (osd
) or Ceph Metadata Servers (mds
).
There are a few ways to add a user:
-
ceph auth add
: This command is the canonical way to add a user. It will create the user, generate a key and add any specified capabilities. -
ceph auth get-or-create
: This command is often the most convenient way to create a user, because it returns a keyfile format with the user name (in brackets) and the key. If the user already exists, this command simply returns the user name and key in the keyfile format. You may use the-o {filename}
option to save the output to a file. -
ceph auth get-or-create-key
: This command is a convenient way to create a user and return the user’s key (only). This is useful for clients that need the key only (e.g., libvirt). If the user already exists, this command simply returns the key. You may use the-o {filename}
option to save the output to a file.
When creating client users, you may create a user with no capabilities. A user with no capabilities is useless beyond mere authentication, because the client cannot retrieve the cluster map from the monitor. However, you can create a user with no capabilities if you wish to defer adding capabilities later using the ceph auth caps
command.
A typical user has at least read capabilities on the Ceph monitor and read and write capability on Ceph OSDs. Additionally, a user’s OSD permissions are often restricted to accessing a particular pool. :
ceph auth add client.john mon 'allow r' osd 'allow rw pool=liverpool' ceph auth get-or-create client.paul mon 'allow r' osd 'allow rw pool=liverpool' ceph auth get-or-create client.george mon 'allow r' osd 'allow rw pool=liverpool' -o george.keyring ceph auth get-or-create-key client.ringo mon 'allow r' osd 'allow rw pool=liverpool' -o ringo.key
ceph auth add client.john mon 'allow r' osd 'allow rw pool=liverpool'
ceph auth get-or-create client.paul mon 'allow r' osd 'allow rw pool=liverpool'
ceph auth get-or-create client.george mon 'allow r' osd 'allow rw pool=liverpool' -o george.keyring
ceph auth get-or-create-key client.ringo mon 'allow r' osd 'allow rw pool=liverpool' -o ringo.key
If you provide a user with capabilities to OSDs, but you DO NOT restrict access to particular pools, the user will have access to ALL pools in the cluster!
7.4. Modify User Capabilities 复制链接链接已复制到粘贴板!
The ceph auth caps
command allows you to specify a user and change the user’s capabilties. To add capabilities, use the form:
ceph auth caps USERTYPE.USERID {daemon} 'allow [r|w|x|*|...] [pool={pool-name}] [namespace={namespace-name}'
ceph auth caps USERTYPE.USERID {daemon} 'allow [r|w|x|*|...] [pool={pool-name}] [namespace={namespace-name}'
For example:
ceph auth caps client.john mon 'allow r' osd 'allow rw pool=liverpool' ceph auth caps client.paul mon 'allow rw' osd 'allow rwx pool=liverpool' ceph auth caps client.brian-manager mon 'allow *' osd 'allow *'
ceph auth caps client.john mon 'allow r' osd 'allow rw pool=liverpool'
ceph auth caps client.paul mon 'allow rw' osd 'allow rwx pool=liverpool'
ceph auth caps client.brian-manager mon 'allow *' osd 'allow *'
To remove a capability, you may reset the capability. If you want the user to have no access to a particular daemon that was previously set, specify an empty string. For example:
ceph auth caps client.ringo mon ' ' osd ' '
ceph auth caps client.ringo mon ' ' osd ' '
See Authorization (Capabilities)_ for additional details on capabilities.
7.5. Delete a User 复制链接链接已复制到粘贴板!
To delete a user, use ceph auth del
:
ceph auth del {TYPE}.{ID}
ceph auth del {TYPE}.{ID}
Where {TYPE}
is one of client
, osd
, mon
, or mds
, and {ID}
is the user name or ID of the daemon.
7.6. Print a User’s Key 复制链接链接已复制到粘贴板!
To print a user’s authentication key to standard output, execute the following:
ceph auth print-key {TYPE}.{ID}
ceph auth print-key {TYPE}.{ID}
Where {TYPE}
is one of client
, osd
, mon
, or mds
, and {ID}
is the user name or ID of the daemon.
Printing a user’s key is useful when you need to populate client software with a user’s key (e.g., libvirt). :
mount -t ceph serverhost:/ mountpoint -o name=client.user,secret=`ceph auth print-key client.user`
mount -t ceph serverhost:/ mountpoint -o name=client.user,secret=`ceph auth print-key client.user`
7.7. Import a User(s) 复制链接链接已复制到粘贴板!
To import one or more users, use ceph auth import
and specify a keyring:
ceph auth import -i /path/to/keyring
ceph auth import -i /path/to/keyring
For example:
sudo ceph auth import -i /etc/ceph/ceph.keyring
sudo ceph auth import -i /etc/ceph/ceph.keyring
The ceph storage cluster will add new users, their keys and their capabilities and will update existing users, their keys and their capabilities.