I accidentally created an account on Debian with the naming convention below:
Can anyone tell me how do I delete this? I entered "^Xclear"
I accidentally created an account on Debian with the naming convention below:
Can anyone tell me how do I delete this? I entered "^Xclear"
User accounts are typically defined by their presence in two files, and a home directory devoted to the account. You might also have created a group with this strange character in it. The two files are /etc/passwd and /etc/shadow and the directory is typically under /home/. Groups are defined in /etc/group.
Warning: the following edits important system files in place. If you are worried about that going wrong, copy these files before hand with something like this sudo cp /etc/passwd /etc/shadow /etc/group /root/. You can always copy them back with sudo cp /root/passwd /root/shadow /root/group /etc/.
In your case, the following two edits should remove the lines from the user files:
/etc/passwd:
$ sudo sed -i.bak -e '/.*\:1003\:1003\:.*/d' /etc/passwd
/etc/shadow:
$ sudo sed -i.bak -e '/^.clear\:.*/d' /etc/shadow
At this point, the account will be effectively deleted. The -i .bak options are a safety measure: they will cause sed to create a backup copy of the original files with the .bak extension (e.g. /etc/passwd.bak). This can help you recover if you break anything.
There are two other things you might want to do to clean up:
One is to look in /etc/group and see if you also created a group with this strange character in it? Something like this would delete it:
/etc/shadow:
$ sudo sed -i -e '/^.clear\:.*/d' /etc/group
Finally, if you look in the /home/ directory, do you see a strangely named directory? You can rename it with sudo mv /home/?clear /home/was-clear and then, when you are sure it is the right directory etc, remove it with sudo rm -rf /home/was-clear.