Deleting a user account from a VirtualBox virtual machine
To delete a user account from a VirtualBox virtual machine, you log into the guest operating system (the one running inside the virtual machine), open the user management tool for that operating system, and remove the account from there. VirtualBox itself does not manage user accounts — the operating system inside the virtual machine does. This means the steps change depending on whether you are running Windows, Linux, or macOS inside your virtual machine.
The process is the same as deleting a user account on a physical computer. You are not deleting anything from VirtualBox's own settings. You are deleting an account that exists inside the guest operating system, just as you would on a regular machine.
Key Takeaways
- User accounts live inside the guest operating system, not in VirtualBox itself, so you delete them using the operating system's own tools.
- On Windows, use Settings > Accounts > Other people, or the Computer Management console for more control.
- On Linux, use the command line with userdel or a graphical tool like GNOME Settings, depending on your distribution.
- Before deleting an account, back up any files the user owns, because deletion usually removes the user's home folder and all its contents.
- You must be logged in as an administrator or root user to delete another user's account.
Deleting a user on Windows inside VirtualBox
Start by logging into the Windows guest operating system with an administrator account. Click the Start button, then type "Settings" and open the Settings app. Navigate to Accounts on the left sidebar, then click Other people.
Find the user account you want to delete in the list. Click it once to select it, then click the Remove button. Windows will ask you to confirm. When you click Delete account and data, Windows removes the account and deletes the user's home folder (usually C:\Users\[username]) along with all files inside it. This action cannot be undone, so move any files you need to keep before you proceed.
If you need more control — for example, to delete the account but keep the user's files — use Computer Management instead. Press Windows key + R, type compmgmt.msc, and press Enter. Navigate to Local Users and Groups > Users, right-click the account you want to delete, and select Delete. This method removes the account but leaves the user's home folder behind, so you can move files out before deleting the folder manually.
Deleting a user on Linux inside VirtualBox
The method depends on your Linux distribution. Most distributions include a graphical user management tool. On Ubuntu or Debian-based systems, open Settings (or System Settings), find the Users or Accounts section, click the user you want to remove, and look for a Delete or Remove button. You may need to unlock the settings panel first by clicking a lock icon and entering your password.
If your distribution does not have a graphical tool, or if you prefer the command line, open a terminal and use the userdel command. First, log in as root or use sudo. Type sudo userdel username (replace "username" with the actual account name) and press Enter. This removes the account but leaves the user's home folder in place. To delete the home folder as well, use sudo userdel -r username. The -r flag tells the system to remove the user's home directory and all files inside it.
Before running userdel -r, make sure you have backed up any files you need to keep. Once the command runs, the files are gone.
Deleting a user on macOS inside VirtualBox
Log in with an administrator account. Click the Apple menu in the top-left corner, then select System Settings (or System Preferences on older versions). Click General on the left sidebar, then click Users & Groups (or Accounts on newer versions).
Click the lock icon in the bottom-left corner and enter your administrator password to unlock the settings. Select the user account you want to delete from the list on the left, then click the minus button (–) below the list. macOS will ask whether you want to keep or delete the user's home folder. Choose Delete the home folder to remove both the account and all its files, or Keep the home folder if you want to save the files first. After you confirm, the account is removed.
What happens to files when you delete a user
When you delete a user account, the operating system typically removes the user's home folder — the directory where all that user's personal files, documents, and settings are stored. On Windows, this is usually C:\Users\[username]. On Linux, it is usually /home/username. On macOS, it is usually /Users/username.
If you delete the account without backing up these files first, they are lost. Some operating systems offer an option to keep the home folder after deleting the account, but the folder becomes orphaned — it is owned by a user ID that no longer exists, and you may have trouble accessing it later. The safest approach is to copy any files you need to a shared folder or external drive before you delete the account.
Deleting a user does not affect the VirtualBox host
Deleting a user from inside a virtual machine does not affect your main computer (the host). The user account exists only inside the guest operating system, which is isolated from your host machine. You can delete as many users as you want from a virtual machine without changing anything on your actual computer.
If you want to delete a virtual machine entirely — not just a user inside it — that is a different process. You would shut down the virtual machine, then right-click it in the VirtualBox main window and select Remove. But deleting a user account only removes that one account from inside the guest operating system.
Frequently Asked Questions
Can I delete a user account while that user is logged in?
No. The operating system will not let you delete an account that is currently in use. Log in with a different administrator account first, then delete the account you no longer need.
What if I delete a user by mistake?
If you deleted the account but did not delete the home folder, you may be able to recreate the account with the same username and regain access to the files. However, if you used the delete option that removes the home folder, the files are permanently gone. This is why backing up before deletion is important.
Do I need to shut down the virtual machine to delete a user?
No. You can delete a user while the virtual machine is running, just as you would on a regular computer. The virtual machine does not need to be stopped.
Will deleting a user account free up disk space on my host computer?
Yes, but only if the virtual machine's disk file is set to shrink automatically. By default, VirtualBox allocates a fixed amount of space to each virtual machine. Deleting files inside the guest operating system marks that space as unused, but the virtual machine's disk file on your host computer stays the same size. To reclaim the space, you can use VirtualBox's built-in disk shrinking tool or manually compact the virtual disk.