Managing Users and Groups 3.6
OpenNebula supports user accounts and groups. This guide shows how to manage both. To manage user rights, visit the Managing ACL Rules guide.
A user in OpenNebula is defined by a username and password. You don't need to create a new Unix account in the front-end for each OpenNebula user, they are completely different concepts. OpenNebula users are authenticated using a session string included in every operation, which is checked by the OpenNebula core.
Each user has a unique ID, and belongs to a group.
After the installation, you will have two administrative accounts, oneadmin
and serveradmin
; and two default groups. You can check it using the oneuser list
and onegroup list
commands.
There are different user types in the OpenNebula system:
oneadmin
has enough privileges to perform any operation on any object. Any other user in the oneadmin group has the same privileges as oneadmin
OpenNebula users should have the following environment variables set, you may want to place them in the .bashrc of the user's Unix account for commodity:
ONE_XMLRPC | URL where the OpenNebula daemon is listening. By default, it should be http://localhost:2633/RPC2. See the PORT attribute in the Daemon configuration file for more information. |
---|---|
ONE_AUTH | Needs to point to a file containing just a single line stating “username:password”. If ONE_AUTH is not defined, $HOME/.one/one_auth will be used instead. If no auth file is present, OpenNebula cannot work properly, as this is needed by the core, the CLI, and the cloud components as well. |
For instance, a user named regularuser
may have the following environment:
<xterm> $ tail ~/.bashrc ONE_XMLRPC=http://localhost:2633/RPC2 export ONE_XMLRPC $ cat ~/.one/one_auth regularuser:password </xterm>
User accounts within the OpenNebula system are managed by oneadmin
with the oneuser create
and oneuser delete
commands. This section will show you how to create the different account types supported in OpenNebula
Administrators can be easily added to the system like this:
<xterm> $ oneuser create otheradmin password ID: 2
$ oneuser chgrp otheradmin oneadmin
$ oneuser list
ID GROUP NAME AUTH PASSWORD 0 oneadmin oneadmin core 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8 1 oneadmin serveradmin server_c 1224ff12545a2e5dfeda4eddacdc682d719c26d5 2 oneadmin otheradmin core 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8
$ oneuser show otheradmin USER 2 INFORMATION ID : 2 NAME : otheradmin GROUP : 0 PASSWORD : 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8 AUTH_DRIVER : core ENABLED : Yes
USER TEMPLATE
</xterm>
Simply create the usets with the create command:
<xterm> $ oneuser create regularuser password ID: 3 </xterm>
The enabled flag can be ignored as it doesn't provide any functionality. It may be used in future releases to temporarily disable users instead of deleting them.
Public users needs to define a special authentication method that internally relies in the core auth method. First create the public user as it was a regular one:
<xterm> $ oneuser create publicuser password ID: 4 </xterm>
and then change its auth method (see below for more info) to the public authentication method.
<xterm> $ oneuser chauth publicuser public </xterm>
Server user accounts are used mainly as proxy authentication accounts for OpenNebula services. Any account that uses the server_cipher or server_x509 auth methods are a server user. You will never use this account directly. To create a user account just create a regular account
<xterm> $ oneuser create serveruser password ID: 5 </xterm>
and then change its auth method to server_cipher
(for other auth methods please refer to the External Auth guide):
<xterm> $ oneuser chauth serveruser server_cipher </xterm>
Each user has an authentication driver, AUTH_DRIVER
. The default driver, core
, is a simple user-password match mechanism. Read the External Auth guide to improve the security of your cloud, enabling SSH or x509 authentication.
The USER TEMPLATE
section can hold any arbitrary data. You can use the oneuser update
command to open an editor and add, for instance, the following DEPARTMENT
and EMAIL
attributes:
<xterm> $ oneuser show 2 USER 2 INFORMATION ID : 2 NAME : regularuser GROUP : 1 PASSWORD : 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8 AUTH_DRIVER : core ENABLED : Yes
USER TEMPLATE DEPARTMENT=IT EMAIL=user@company.com </xterm>
These attributes can be later used in the Virtual Machine Contextualization. For example, using contextualization the user's public ssh key can be automatically installed in the VM:
ssh_key = "$USER[SSH_KEY]"
Regular users can see their account information, and change their password.
For instance, as regularuser
you could do the following:
<xterm>
$ oneuser list
[UserPoolInfo] User [2] not authorized to perform action on user.
$ oneuser show USER 2 INFORMATION ID : 2 NAME : regularuser GROUP : 1 PASSWORD : 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8 AUTH_DRIVER : core ENABLED : Yes
USER TEMPLATE DEPARTMENT=IT EMAIL=user@company.com
$ oneuser passwd 1 abcdpass </xterm>
As you can see, any user can find out his ID using the oneuser show
command without any arguments.
Regular users have a special Sunstone dashboard with information about their quotas and their virtual machines.
A group in OpenNebula makes possible to isolate users and resources. A user can see and use the shared resources from other users.
There are two special groups created by default. The onedmin
group allows any user in it to perform any operation, allowing different users to act with the same privileges as the oneadmin
user. The users
group is the default group where new users are created.
Your can use the onegroup
command line tool to manage groups in OpenNebula. There are two groups created by default, oneadmin
and users
.
To create new groups: <xterm> $ onegroup list
ID NAME 0 oneadmin 1 users
$ onegroup create “new group” ID: 100 ACL_ID: 2 ACL_ID: 3 </xterm>
The new group has ID 100 to differentiate the special groups to the user-defined ones.
When a new group is created, two ACL rules are also created to provide the default behaviour. You can learn more about ACL rules in this guide; but you don't need any further configuration to start using the new group.
Use the oneuser chgrp
command to assign users to groups.
<xterm> $ oneuser chgrp -v regularuser “new group” USER 1: Group changed
$ onegroup show 100 GROUP 100 INFORMATION ID : 100 NAME : new group
USERS ID NAME 1 regularuser </xterm>
To delete a user from a group, just move it again to the default users
group.
All the described functionality is available graphically using Sunstone:
Non-admin users will also have access to a user list and a group list. For non-priviledged users, these lists will only contain the user logged in and the group they belong to. VDC administrators will be able to manage VDC users. Note these tabs appear as submenus of the main dashboard for regular users, since no system dashboard is available.