エラーの園

仕事、日常のあらゆるエラーと戦い、先人の知恵も拝借して何としても解決……したい!

E325: ATTENTION...

エラー発生前の操作や設定など

UbuntuVimエディターでSSHの設定ファイルを編集中、
矢印キーが想定通りに動作せず、強引にターミナルを閉じた。
別ターミナルで、sudo vi /etc/ssh/sshd_configを実行した。

エラー内容

E325: ATTENTION  
Found a swap file by the name "/etc/ssh/.sshd_config.swp"  
          owned by: root   dated: Wed May 13 18:45:30 2020  
         file name: /etc/ssh/sshd_config  
          modified: YES  
         user name: root   host name: kuroneko-PC-LL550VG1JR  
        process ID: 3438  
While opening file "/etc/ssh/sshd_config"  
             dated: Wed May 13 18:40:52 2020  
  
(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" 88 lines, 2541 characters  
Press ENTER or type command to continue  

参考サイト

https://qiita.com/elu_jaune/items/1e81a650dec942f55c0b
ありがとうございます!助かりました🙇🏻‍♀️

原因

最初のターミナルが該当ファイルを掴んでいたのに、
強引に閉じて別ターミナルで同一ファイルを開こうとしたため。

参考サイトより一部抜粋

多重オープンしてしまった。

作業環境

OS:"Ubuntu"  
VERSION:"14.04.6 LTS, Trusty Tahr"  

解決手順

1.開きたいファイルのswapファイルができているとのことなので、swapファイルを確認。

$ sudo ls -la /etc/ssh  
合計 316  
drwxr-xr-x   2 root root   4096  5月 13 18:52 .  
drwxr-xr-x 132 root root  12288  5月 13 18:49 ..  
-rw-r--r--   1 root root  16384  5月 13 18:45 .sshd_config.swp  
  
...(中略)...  
  
-rw-r--r--   1 root root   2541  5月 13 18:40 sshd_config  

2.swapファイルを削除する。

$ sudo rm .sshd_config.swp  

3.確認として、開きたいファイルを開いてみる。

$ sudo vi /etc/ssh/sshd_config  

開きました!

# Package generated configuration file  
# See the sshd_config(5) manpage for details  
  
# What ports, IPs and protocols we listen for  
Port 10022  
# Use these options to restrict which interfaces/protocols sshd will bind to  
#ListenAddress ::  
#ListenAddress 0.0.0.0