UniFi - USW Leaf: User Accounts

2023-02-13 20:55:27 UTC

Overview

This article describes default user accounts available on USW-Leaf and gives an overview of methods to save changes made to user configuration..

NOTES & REQUIREMENTS:
  • The USW-Leaf is currently available in the Early Access store and discussed in the Beta section of the Community. To view these, please make sure you have Early Access enabled for your Ubiquiti account and that you are logged in.

Table of Contents

  1. Default User Accounts
  2. Saving Persistent Configuration Changes
  3. Related Articles

Default User Accounts

By default, the USW-Leaf has uses two built-in user accounts: ubnt and root.

The ubnt account:

  • Uses the default password: ubnt
  • Is a user account in the wheel group with sudo privileges.
  • Can log in to the system through all the usual channels, such as console and SSH.

The root account:

  • Uses the default password: ubnt
  • Can log in to the system through all the usual channels, such as console and SSH.
  • Has the standard Linux root user access to everything on the switch.
ATTENTION: For optimal security, it is recommended to change the default password before proceeding to configure the device. Use the passwd command and follow its instructions.

Additional user accounts can be added as needed. Like the ubnt account, these accounts must use sudo to execute privileged commands. Be sure to include them in the wheel group. For example:

CLI: Access the Command Line Interface on the USW-Leaf using SSH.

1. Log in to device using your credentials.

2. You will be presented with the below prompt:

  ___ ___      .__________.__
 |   |   |____ |__\_  ____/__|
 |   |   /    \|  ||  __) |  |   (c) 2010-2020
 |   |  |   |  \  ||  \   |  |   Ubiquiti Inc.
 |______|___|  /__||__/   |__|
            |_/                  https://www.ui.com/

      Welcome to UniFi Switch Spine!
Type 'vtysh' to start configuration. $

3. Add a new user account with the below command (replace newuser with your preferred account name):

sudo adduser newuser wheel

4. Enable sudo access for the newly created user account:

sudo addgroup newuser wheel

5. Set a password for the user account:

sudo passwd newuser

6. Try logging in with the newly created user account.

Saving Persistent Configuration Changes

USW-Leaf uses overlayfs to maintain a vanilla version of the filesystem intact. By default, changes to the filesystem do not persist through reboot because they are being saved to the tmpfs layer of overlayfs. In order to save changes to /etc/passwd, /etc/shadow, /etc/group and user home directories they must be placed onto the partition that participates as a read-write layer of overlayfs, which is located in /mnt/data/overlay.

We call the procedure of saving changes made to the filesystem onto persistent layer a writeback. There is a writeback tool that makes the process of saving your work easier. Follow the steps below to save persistent changes using the writeback command:

CLI: Access the Command Line Interface on the USW-Leaf using SSH.

1. Log in to device using your credentials.

2. You will be presented with the below prompt:

  ___ ___      .__________.__
 |   |   |____ |__\_  ____/__|
 |   |   /    \|  ||  __) |  |   (c) 2010-2020
 |   |  |   |  \  ||  \   |  |   Ubiquiti Inc.
 |______|___|  /__||__/   |__|
            |_/                  https://www.ui.com/

      Welcome to UniFi Switch Spine!
Type 'vtysh' to start configuration. $

3. For example, to save changes made to user management files:

sudo writeback /etc/passwd
sudo writeback /etc/shadow
sudo writeback /etc/group

4. Save changes to the home directory of the newly created user in the section above:

sudo writeback /home/newuser

Note that such operation should be performed every time a new file is created in this directory:

cd ~
touch important_file
writeback important_file

 Sometimes it is desirable to have user home directory reside on persistent filesystems, e.g. to have their commands history persist through reboot without explicit writeback. For such case a symlink approach can be taken:

sudo mkdir /mnt/persistent/home
sudo mv /home/* /mnt/persistent/home/
sudo rm -rf /home
sudo ln -s /mnt/persistent/home /home

Related Articles

UniFi - USW Leaf: Backup & Restore Configuration

UniFi - USW Leaf: CLI Command Comparison

Was this article helpful?
30 out of 55 found this helpful