此篇博客介绍了解决Creating mailbox file: File exists问题方法和出错原因

解决办法

当想使用useradd user2创建用户user2时,如果出现了Creating mailbox file: File exists问题。就直接删除/var/spool/mail//home下的之前存在的user2文件。删除后在重新建立,就能直接成功。

[root@xixi mnt]# userdel -r user2          #  注意报错信息
userdel: /var/spool/mail/user2 not owned by user2, not removing
userdel: /home/user2 not owned by user2, not removing
[root@xixi mnt]# ls /home                  #查看/home可发现,存在user2目录
liyanqiu  user1  user2  westos  westos1
[root@xixi mnt]# rm -fr /var/spool/mail/user2      #删除
[root@xixi mnt]# rm -fr /var/spool/mail/user2
[root@xixi mnt]#
[root@xixi mnt]# id user2
id: user2: no such user
[root@xixi mnt]# useradd user2             #重新建立user2用户,此时可直接建立
[root@xixi mnt]# id user2
uid=1004(user2) gid=1004(user2) groups=1004(user2)

出错原因

步骤详解
1.我在使用useradd创建用户的时候,出现了如下所示错误

[root@xixi mnt]# useradd user2
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
Creating mailbox file: File exists
  • 1
  • 2
  • 3
  • 4

2.此时我查看了/home后,发现存在了一个user2的目录.

[root@xixi mnt]# ls /home
liyanqiu  user1  user2  westos  westos1
[root@xixi mnt]# id user2
uid=1004(user2) gid=1004(user2) groups=1004(user2)
  • 1
  • 2
  • 3
  • 4

为了验证是否建立成功,我决定使用userdel -r user2来删除用户试试,此时却报错了

[root@xixi mnt]# userdel -r user2
userdel: /var/spool/mail/user2 not owned by user2, not removing
userdel: /home/user2 not owned by user2, not removing
  • 1
  • 2
  • 3

这是因为第一次我之前创建过user2,但是在使用userdel命令删除的时候,忘记了-r的使用。我在回顾了用户管理部分知识的时候,发现:

  • 出错原因:只删除了用户,并未删除用户的配置文件
删除 作用
userdel westos 只删除了用户,并未删除用户的配置文件
userdel -r westos 删除了用户和用户的配置文件
  • 解决:在删除了用户之后,如果想要删除其配置文件则有两种方法:一种是重新建立后利用 " -r "。另一种是找到配置文件所在目录,然后利用“rm -fr ”进行删除。

解决出现Creating mailbox file: File exists问题,并分析出错原因相关推荐

  1. 解决linux下创建用户时出现Creating mailbox file: File exists

    在linux下用useradd添加用户时,出现错误: Creating mailbox file: File exists? 为什么会出现这样的问题? 原来linux下添加用户后,会在系统里自动加一个 ...

  2. 删除根目录文件方法,解决报错EEXIST: file already exists

    报错 : EEXIST: file already exists, symlink '-/lib/node_modules/@ies/eden-monorepo/bin/cli.js' -> ' ...

  3. 成功解决CondaError: Error reading file, file should be a text file containing packages conda create --he

    成功解决CondaError: Error reading file, file should be a text file containing packages conda create --he ...

  4. 成功解决OSError: cannot open resource File F:Python36\lib\site-packages\PIL\ImageFont.py, self.font

    成功解决OSError: cannot open resource File "F:Python36\lib\site-packages\PIL\ImageFont.py", se ...

  5. 解决 TortoiseGit 诡异的 Bad file number 问题(转)

    问题描述 昨天,以及今天(2014-11-29),使用 TortoiseGit 时碰到了一个诡异的问题. 卸载,清理注册表,重装,重启,各种折腾以后,还是不能解决. 但是23.45分一过,突然灵光一闪 ...

  6. 解决NGINX PHP No input file specified

    解决NGINX PHP "No input file specified" 打开一个页面<?php  phpinfo(); ?>  然后在游览器下运行:页面提示 No ...

  7. MongoDB解决“Error parsing YAML config file: yaml-cpp: error at line 2, column value(安装服务)

    解决"Error parsing YAML config file: yaml-cpp: error at line 2, column 13: illegal map value" ...

  8. The last update operation tried to add the file 'xxx.java',but the file already exists universioned

    The last update operation tried to add the file 'xxx.java',but the file already exists universioned ...

  9. 解决Error: ENOENT: no such file or directory, scandir

    解决Error: ENOENT: no such file or directory, scandir 'xxx\node-sass\vendor' 前端项目持续部署打包中出现一个奇怪的问题,记录一下 ...

  10. 解决Could not open input file: think问题

    解决Could not open input file: think问题 参考文章: (1)解决Could not open input file: think问题 (2)https://www.cn ...

最新文章

  1. 屏幕边框闪光_写给想入手21:9的屏幕党,明基 EX3501R 真香跳坑指南
  2. CVPR 2021 比CNN和Transformer更好的Backbone?伯克利谷歌提出BoTNet,精度达84.7%
  3. (剑指Offer)面试题19:二叉树的镜像
  4. 项目遇到的问题或处理办法
  5. 神不知鬼不觉地置换 XP用户密码
  6. 计算机工程与应用单像素成像,2011计算机工程与应用基于压缩感知理论的单像素成像系统研究_白凌云.pdf...
  7. java j2ssh替代jsch,jsch设置ssh协商算法优先级
  8. ladp3 获取属性_Ldap3库使用方法(四)
  9. Javascript设计模式学习二(单例)
  10. android自动悬浮窗代码,三行代码实现Android应用内悬浮窗,无需一切权限,适配所有ROM和厂商...
  11. android 布局如何居中,Android ConstraintLayout约束布局的居中详解
  12. java事务是什么_在java中,事务是什么?
  13. 共享经济开始崩溃,区块链能否再续共享经济神话?
  14. 罗技GHUB打开一直在加载怎么回事?
  15. 洛谷P1460 健康的荷斯坦奶牛
  16. Cimplicity软件开发的汽车厂监控系统案例
  17. 关键字region的意思
  18. 关于DrawerLayout must be measured with MeasureSpec.EXACTLY问题解决办法
  19. 最新的IPC-TM-650 测试设备供应商清单(IPC官方推荐)
  20. 生活小目标、GTD时间管理、习惯追踪法

热门文章

  1. 怎么样通过API函数获取tooltip的内容(请高手帮忙)
  2. java时间转换为标准时间
  3. python中inf_认识python中的inf和nan
  4. 计算机中分页符号是什么,分节符和分页符有什么区别?
  5. 供应链金融科技产品的核心竞争力究竟是什么?
  6. c语言 close,C++ close()关闭文件方法详解
  7. 计算机无法关闭密码保护,Win7密码保护共享关闭不了怎么办?密码保护共享关不掉的解决方法...
  8. JAVA-数据类型与运算符笔记
  9. java分布式框架-JDF
  10. 大数据分析项目实例:Hadoop数据分析应用场景