Technical Anshu
Tutorials Blog
Nextcloud Hardening

Nextcloud First Login Hardening Admin Account and Two Factor Setup

A fresh Nextcloud is configured for convenience, not for safety. Twenty minutes in the first login turns it into something you can put real files - and later, outside access - behind.

By Technical AnshuUbuntu ServerSelf Hosted8 minute read
Watch the full video - the one-step Nextcloud install on Ubuntu, step by step

The install is finished, the dashboard is pretty, and every default is set to be welcoming. That is exactly why the first login deserves a hardening pass before a single real file moves in: the admin account is doing double duty, there is no second factor, and no password rules. None of the fixes below need the terminal except one optional rescue command - it is all settings, done once.

Settings - Security - the first-login checklist
✅ Admin password - long, unique, saved in a password manager
✅ TOTP two-factor app enabled for the admin account
☐ Recovery codes downloaded and kept offline
☐ Separate normal user created for daily files
☐ Password policy set for all accounts
☐ Sharing defaults reviewed
The six hardening moves - the first two protect the master key, the rest protect everyone else
1

Separate the Admin Account From Your Daily Account

The account the install creates is an administrator - it can change every setting, see every share and reset every password. Using it as your everyday file account means every phone, laptop and browser session carries the master key everywhere.

  1. Open the Users page from the admin menu and create a normal user for yourself - your daily name, no admin group
  2. Log out, log in as the daily user, and keep your files there
  3. From now on, the admin account logs in only when you are changing settings

Two minutes of setup, and a stolen phone session can no longer hand over the whole server.

2

Set a Password Policy for Everyone

Left alone, Nextcloud accepts short passwords. Fix the floor before creating other people's accounts:

  1. As admin, open Settings - Security
  2. In the password policy area, require a sensible minimum length - ten or more characters - and the option to check new passwords against known leaked-password lists, if offered
  3. Save, then create the remaining accounts

Long beats complicated: a passphrase of several ordinary words is stronger and far easier for family and staff to actually keep unique.

3

Turn On Two-Factor for the Admin Account

Two-factor authentication (2FA) means a stolen password alone is not enough - the login also needs the six-digit code from your phone.

  1. As admin, open the app store inside Nextcloud and install the Two-Factor TOTP Provider app
  2. Open your Personal settings - Security and enable TOTP, scanning the code with any authenticator app
  3. Immediately generate the backup codes on the same page and save them offline - printed or in your password manager. They are the only way back in if the phone dies
  4. Log out and back in to prove the full flow works - code asked, code accepted
  5. Only now, if your edition shows the option in Settings - Security, enforce two-factor for the admin group, so no future admin account can skip it

Do the steps in that order. Enforcing 2FA before your own is working is how people lock themselves out of fresh servers.

4

Review the Sharing Defaults

While you are in Settings, walk the Sharing page once with adult eyes. Defaults vary by version, so read each switch rather than trusting a list - the ones to think about are whether users may share public links at all, whether those links may allow uploads, and whether resharing is allowed. A small office often says yes to links and no to public uploads; a family server may allow both. There is no universal right answer - there is only a wrong one, which is never having looked.

5

Remember the Box Underneath

Nextcloud is only as safe as the Ubuntu machine it sits on. The short version: keep Ubuntu's own updates on, use a strong password (or better, a key) for SSH, and do not install random services beside your cloud. One rescue worth knowing before you need it: if a user ever loses both password and second factor, the server admin can disable that user's two-factor from the terminal with sudo nextcloud.occ twofactorauth:disable USERNAME totp - run sudo nextcloud.occ list first to see the exact provider names on your version.

🔴 The order is the safety: two-factor on your admin account, recovery codes saved, login tested - and only then enforcement for anyone else. Every lockout story starts with those steps done in the wrong order.

Watch the Fresh Install You Are Hardening

See the one-step install and the first screens these settings live behind.

Watch Full Video
Frequently Asked Questions

What if I lose my phone with the authenticator app?

That is what the backup codes are for - each works once to log in so you can set up a new phone. If the codes are lost too, whoever controls the server terminal can disable two-factor for your account with the occ command shown above.

Should every user have two-factor, or only admins?

Admins first, always. For everyone else, turn it on for anyone whose files matter - it costs each person one minute with an authenticator app, and it is the single biggest upgrade over a password alone.

Does two-factor slow down daily use?

Only the login asks for a code; sync clients and phone apps stay connected with their own app passwords afterwards. In daily life you will notice it perhaps once a week.

This guide is based on the Technical Anshu Nextcloud install video - stuck on a step? Ask in the video comments and you will get a reply.