AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1206432
Accepted
Jonte YH
Jonte YH
Asked: 2020-01-29 11:14:23 +0800 CST2020-01-29 11:14:23 +0800 CST 2020-01-29 11:14:23 +0800 CST

如何修复 /etc/profile 中的 bash 错误?

  • 772

当我启动我的 Postgresql 需要一段时间,我收到这个奇怪的错误消息,我认为这个文件已损坏?

[tis jan 28 20:03:56] Jonathan@Whats next?:~$ sudo systemctl start postgresql

[sudo] password for jonteyh: 
[tis jan 28 20:04:25] Jonathan@Whats next?:~$ sudo -u postgres -i

ö

-bash: /etc/profile: line 14: syntax error near unexpected token `)'

-bash: /etc/profile: line 14:

-Strange characters


-bash-5.0$ ö


-bash: ö: command not found


-bash-5.0$ psql


psql (11.5 (Ubuntu 11.5-1))


Type "help" for help.

postgres=# 

我该如何解决下面的这个错误?

-bash: /etc/profile: line 14: syntax error near unexpected token `)'

-bash: /etc/profile: line 14:

当我执行 cat /etc/profile: 我在终端中得到这个奇怪的字符时,如下所示:

在此处输入图像描述

bash postgresql
  • 1 1 个回答
  • 424 Views

1 个回答

  • Voted
  1. Best Answer
    Thomas Ward
    2020-01-29T11:35:41+08:002020-01-29T11:35:41+08:00

    不知何故,您的/etc/profile文件已被修改为直接可执行文件。这可能是由于用户错误或有人试图通过在您连接或启动时执行程序来恶意劫持您的系统。

    我会/etc/profile用这样的东西替换你的(这是/etc/profile我 18.04 机器上未更改的文件,与 19.10 中的相同):/etc/profile

    # /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
    # and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
    
    if [ "${PS1-}" ]; then
      if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
        # The file bash.bashrc already sets the default PS1.
        # PS1='\h:\w\$ '
        if [ -f /etc/bash.bashrc ]; then
          . /etc/bash.bashrc
        fi
      else
        if [ "`id -u`" -eq 0 ]; then
          PS1='# '
        else
          PS1='$ '
        fi
      fi
    fi
    
    if [ -d /etc/profile.d ]; then
      for i in /etc/profile.d/*.sh; do
        if [ -r $i ]; then
          . $i
        fi
      done
      unset i
    fi
    

    我还建议您将现有的 /etc/profile 现在是可执行文件,并在将其提交给 VirusTotal 进行分析后将其删除,以查看它是否实际上是公认的恶意软件或其他东西。

    • 4

相关问题

  • 同时复制到两个位置

  • 如何在 shell 脚本中创建选择菜单?

  • 从 bash 迁移到 zsh [关闭]

  • bashrc 还是 bash_profile?

  • 备份 bash 脚本未压缩其 tarball

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve