9

I added user through command

adduser satya

I deleted the same user by

userdel satya

WhenI tried adding again

useradd satya

getting the following error:

Creating mailbox file: File exists

satyamera108
  • 465
  • 1
  • 3
  • 11

2 Answers2

21

Used userdel -r satya for deleting the user, it deleted the mail box too.

Now useradd satya created the user.

satyamera108
  • 465
  • 1
  • 3
  • 11
3

That is because of how you delete a user.

  • useradd username - adds a new user username;

  • [sudo] userdel username - removes a user username leaving intact its files, namely its $HOME directory (/home/username). This is useful when you want to temporarily deactivate a particular user. Now, in some Linux environments (apparently in yours too), mailbox file is under a $HOME directory and that is why, in your case, it did not get deleted;

  • [sudo] userdel -r username - removes a user username and recursively wipes out everything associated with this user (i.e. its $HOME directory).

[x] denotes x being optional.

Giorgi Tsiklauri
  • 9,715
  • 8
  • 45
  • 66