VirtualBox usernames are set during the guest operating system installation, not in VirtualBox itself
When you create a virtual machine in VirtualBox, the username belongs to the operating system running inside it — Windows, Linux, macOS, or whatever else you installed. VirtualBox has no username field of its own. To change your username, you log into that guest operating system and change it there, using the same steps you would on a physical computer.
The process differs depending on whether you're running Windows, Linux, or macOS inside your virtual machine. Each operating system stores usernames in different places and requires different steps to change them. This guide covers the most common scenarios.
Key Takeaways
- Your VirtualBox username lives in the guest operating system, not in VirtualBox itself, so you change it using that OS's built-in tools.
- On Windows, use Settings > Accounts > Your info to change your account name, or Settings > Accounts > Other people if you're changing a different user account.
- On Linux, use the terminal command usermod -l newusername oldusername or your desktop environment's user management tool.
- Changing a username does not affect your VirtualBox settings, snapshots, or saved states — only the account name inside the virtual machine changes.
- If you cannot log in to change the username, you may need to boot into safe mode or use a live Linux USB to reset the account.
Changing your username on Windows inside VirtualBox
Start by logging into your Windows virtual machine with an account that has administrator rights. Click the Start button, then type "Settings" and open the Settings app. Navigate to Accounts, then click Your info on the left side.
Under "Your info," you'll see your current username displayed. Click the button labeled Rename your account. Windows will ask you to confirm the new name you want to use. Type the new username and click Next, then Finish. You'll need to sign out and sign back in for the change to take effect.
If you're changing a different user account rather than your own, go to Accounts and click Other people instead. Select the account you want to change, click Rename, enter the new name, and confirm. That account holder will see the change the next time they log in.
Changing your username on Linux inside VirtualBox
Linux usernames are changed from the terminal. Open a terminal window — usually by right-clicking the desktop or pressing Ctrl+Alt+T, depending on your Linux distribution. You'll need to use the usermod command, which requires root or sudo access.
Type this command, replacing "oldusername" with your current username and "newusername" with what you want it to be:
sudo usermod -l newusername oldusername
Press Enter and type your password when prompted. The system will change your login username when ready. However, your home directory will still be named after your old username. To rename that as well, use this command:
sudo usermod -d /home/newusername -m oldusername
If your Linux distribution has a graphical user management tool, you can also use that. In Ubuntu, for example, open Settings, go to Users, unlock the panel with your password, select your account, and click the username field to edit it directly.
Changing your username on macOS inside VirtualBox
On macOS, open System Preferences (or System Settings on newer versions) and click Users & Groups. Click the lock icon in the bottom left and enter your password to unlock the panel. Right-click your account name in the list on the left and select Advanced Options.
In the Advanced Options window, you'll see a field labeled Short Name — this is your username. Change it to what you want, then click OK. Your account name in the Users list will update, and the change takes effect when ready. You do not need to log out and back in, though you may want to restart any open applications.
What happens to your files and settings when you change your username
Changing your username inside the guest operating system does not affect VirtualBox itself. Your virtual machine will continue to work exactly as before. Snapshots, saved states, and all your virtual machine settings remain unchanged.
Inside the guest operating system, most of your files and settings stay with you because they're tied to your user account, not your username. However, some applications store paths that include your old username. If you notice broken shortcuts or missing files after the change, those applications may need to be reconfigured to point to your new home directory path.
If you cannot log in to change your username
If you've forgotten your password or cannot access the account you want to change, you have options depending on your operating system. On Windows, you can restart the virtual machine and press Shift repeatedly during startup to access the boot menu, then choose to boot into Safe Mode with Command Prompt. From there, you can use the net user command to reset the password on any account.
On Linux, restart the virtual machine and interrupt the boot process by holding Shift (on most distributions). Select the recovery or single-user mode option from the boot menu. This gives you root access without needing a password, and you can use the usermod command to change any username.
On macOS, restart and hold Command+S during startup to enter single-user mode. From there, you can use the dscl command to change usernames, though the syntax is more complex. If you're not comfortable with command-line tools, you can also boot from a macOS recovery USB and use the Utilities menu to reset the account.
Frequently Asked Questions
Does changing my username in the virtual machine affect my VirtualBox login?
No. VirtualBox itself has no username system — you log into your host computer (your real computer) separately from any virtual machine. Changing the username inside a virtual machine only affects that guest operating system and does not touch your host computer at all.
Will my programs stop working if I change my username?
Most programs will continue to work because they don't depend on your username. However, some applications store file paths that include your old username. If a program can't find its data files after the change, you may need to reinstall it or point it to the new location manually. This is rare but does happen with older software.
Can I change my username without restarting the virtual machine?
On Windows and macOS, you can change your username without restarting, though you'll need to log out and back in. On Linux, the change takes effect when ready in the terminal, but you should log out of your desktop session and back in to see the change reflected everywhere. VirtualBox itself never needs to restart.
What if I change my username and then can't find my files?
Your files are still there — they're just in a directory path that may still reference your old username. On Windows, open File Explorer and navigate to C:\Users\ to see both the old and new folder names. On Linux and macOS, open your file manager and look in /home/ or /Users/ respectively. You can move files to the new location or create a symbolic link to the old one.
Can I have multiple usernames in the same virtual machine?
Yes. Each operating system supports multiple user accounts. On Windows, use Settings > Accounts > Other people > Add account. On Linux, use sudo useradd newusername. On macOS, use System Preferences > Users & Groups > Add (+) button. Each account has its own username, password, and home directory.