local-users docs - tutorial

Tutorial: Get started

Here’s how to get started with using the charm-local-users application.

Firstly, create a configuration file as shown below:


$ cat config-local-users.yaml
local-users:
  group: mygroup
  users: |
    alice;Alice;ssh-rsa ABC alice@desktop
    bob;Bob;ssh-rsa XYZ bob@laptop

Deploy any principal charm application of your choice, e.g. Ubuntu

juju deploy ubuntu

Deploy the charm-local-users application providing the path to the configuration file you created earlier:

juju deploy --config config-local-users.yaml local-users

Relate to the principal charm application.

juju relate local-users ubuntu

The charm can also be configured after deployment.

For example, to remove bob’s account, create an updated user list file user.lst that doesn’t include Bob’s account anymore and simply update the config:

$ cat user.lst
alice;Alice;ssh-rsa ABC alice@desktop

Now provide this config to the charm.

juju config local-users users=@user.lst

The charm will enter a blocked state if you try to add a user account that already exists but isn’t a member of the managed group. If you’re sure that you want to add the pre-existing account to the managed group anyway, making it a charm managed account from now, you can run:

juju config local-users allow-existing-users=true

Home directories of removed users will be backed up in the location specified in the backup-path config option before being removed.