首页 > 解决方案 > WHM 终端帮助 - SWAP 文件删除

问题描述

我只是想在 DigitalOcean 上设置一个 WHM/cPanel 用于教育目的。

我找到了这个链接来保护 WHM - https://www.pickaweb.co.uk/kb/cpanel-whm-server-security/

将运行此命令

vi /etc/ssh/sshd_config

我遇到错误(我之前尝试过该命令,但我没有保存就断开了连接)

E325: ATTENTION
Found a swap file by the name "/etc/ssh/.sshd_config.swp"
      owned by: root   dated: Tue Oct 16 13:18:49 2018
     file name: /etc/ssh/sshd_config
      modified: YES
     user name: root   host name: host.enrich.press
    process ID: 13934
While opening file "/etc/ssh/sshd_config"
         dated: Tue Oct 16 14:45:07 2018
  NEWER than swap file!

(1) Another program may be editing the same file.  If this is the case,
be careful not to end up with two different instances of the same
file when making changes.  Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r /etc/ssh/sshd_config"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file "/etc/ssh/.sshd_config.swp"
to avoid this message.
"/etc/ssh/sshd_config" 140L, 3944C
Press ENTER or type command to continue

我该如何处理?

标签: sshterminalcpanelwhm

解决方案


您很可能错误地退出了 vim(停止作业并将其置于后台),或者您有另一个终端也在编辑相同的文件。简而言之,vim 在您编辑文件时创建交换文件,在该文件中写入更改,并在您退出 vim 后删除该文件,即停止进程。所以你有几个选择:

  1. 关闭 vim 的另一个实例并再次打开文件
  2. 例如,如果您已使用 ctrl+z 停止 vim,然后执行,jobs那么您将获得一个列表,其中包含正在运行的事物名称前面的数字,一旦知道作业的编号,只需执行fg 1或无论数字是多少
  3. (不是很好,但有时是必要的)删除.swp文件并再次打开文件

希望这可以帮助!


推荐阅读