修復無頭 Ubuntu ssh 伺服器上損壞的 update-motd.d 資料夾和文件

修復無頭 Ubuntu ssh 伺服器上損壞的 update-motd.d 資料夾和文件

我試圖修復 motd .d 文件,以便它們在我的 Android 設備上啟動 ssh 時顯示,並且我使用在線教程來嘗試修復它們。

現在我無法透過輸入來測試它們,run-parts /etc/update-motd.d因為我不斷收到以下錯誤。

run-parts: failed to exec /etc/update-motd.d/00-header:Exec format error
run-parts: /etc/update-motd.d/00-header exited with return code 1
run-parts: failed to exec /etc/update-motd.d/10-sysinfo: Exec format error
run-parts: /etc/update-motd.d/10-sysinfo exited with return code 1
run-parts: failed to exec /etc/update-motd.d/90-footer: Exec format error
run-parts: /etc/update-motd.d/90-footer exited with return code 1

輸入後systemctl status motd我會在螢幕上看到這個

motd.service
   Loaded: masked (/dev/null; bad)
   Active: inactive (dead)

文件內容/etc/update-motd.d/

/etc/update-motd.d/00-header:  ASCII text
/etc/update-motd.d/10-sysinfo: ASCII text
/etc/update-motd.d/90-footer:  ASCII text

輸出ls -l /etc/update-motd.d/

-rwxr-xr-x 1 root root 1429 Jun  9 14:22 00-header
-rwxr-xr-x 1 root root 1927 Jun  9 14:25 10-sysinfo
-rwxr-xr-x 1 root root 2205 Jun  9 14:29 90-footer

答案1

我實際上也遇到了同樣的問題,而且我的錯誤很簡單:

我忘記了#!/bin/sh

相關內容