关于创建新登录账户及安装阶段账户冲突的技术求助
Hey there, let's work through this account issue step by step! It sounds like you picked an existing username during installation and now need to set up a new login—no worries, this is totally fixable.
First off, that sudo -n [name] command you tried isn't for creating users. All it does is attempt to run a command as the specified user without prompting for a password, which only works if that user already exists and your current account has permission to do so. So that's why it didn't help here.
Here's what you should do instead, depending on where you're at:
If you're still in the installation process
Many Linux distros (like Ubuntu) let you go back to the username selection screen. Look for a "Back" or "<" button in the installer interface—click that, and you can pick a new, unique username to create your account with. That's the simplest solution if you haven't finished installing yet.
If you've already finished installing and are in the system
Open up a terminal (press Ctrl+Alt+T if you're on a desktop) and follow these commands:
- Create a new user with a home directory:
Use theaddusercommand—it walks you through setting up everything nicely:
Replacesudo adduser your_new_usernameyour_new_usernamewith the name you want. You'll be prompted to set a password, then asked for optional details like full name or phone number (you can just press Enter to skip those). - Give the new user admin privileges (if you want them):
If you want the new account to be able to usesudofor administrative tasks, add them to thesudogroup:sudo usermod -aG sudo your_new_username - Test the new account:
You can switch to the new user right away with:
Or log out of your current session and select the new username from the login screen.su - your_new_username
Optional: Remove the duplicate account (if needed)
If you don't want the existing username you accidentally picked, you can delete it once you're logged into your new account. Just run:
sudo deluser --remove-home old_username
The --remove-home flag deletes the user's home directory along with the account—leave it out if you want to keep those files. Just make sure you're not deleting a system-critical account (like root or your original admin account)!
备注:内容来源于stack exchange,提问作者DoofenshmirtzLL

