我曾经chmod
使目录中的所有内容都可执行。但是,当我尝试以普通用户(我)身份运行该目录中的程序之一时,我收到一条“未找到命令”消息。如果我运行su
,程序就会运行。我缺少什么?我正在运行 Fedora 22。这是一个完整的 bash 会话。 (它还表明我的 git 安装不完整,但我认为这无关紧要。)
bash: home/brian/git-completion.bash: No such file or directory
bash: /home/brian/git-prompt.sh: No such file or directory
bash: __git_ps1: command not found...
brian ~ $ ipython
bash: ipython: command not found...
Similar command is: 'python'
bash: __git_ps1: command not found...
brian ~ $ su
Password:
bash: home/brian/git-completion.bash: No such file or directory
bash: /root/git-prompt.sh: No such file or directory
bash: __git_ps1: command not found...
root brian $ ipython
Python 2.7.10 |Anaconda 2.3.0 (64-bit)| (default, May 28 2015, 17:02:03)
Type "copyright", "credits" or "license" for more information.
IPython 3.2.0 -- An enhanced Interactive Python.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]:
另外,这里是我的 .bashrc 的完整列表:
sudo# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Enable tab completion
source home/brian/git-completion.bash
# colors!
green="\[\033[0;32m\]"
blue="\[\033[0;34m\]"
purple="\[\033[0;35m\]"
reset="\[\033[0m\]"
# Change command prompt
source ~/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=1
# '\u' adds the name of the current user to the prompt
# '\$(__git_ps1)' adds git-related stuff
# '\W' adds the name of the current directory
export PS1="$purple\u$green\$(__git_ps1)$blue \W $ $reset"
# added by Anaconda 2.3.0 installer
export PATH="/root/anaconda/bin:$PATH"
答案1
这看起来与权限无关。您会看到“权限被拒绝”,而不是“找不到命令”。
发生的事情是你似乎有.
你的$PATH
根(这是疯狂的),但不适用于您自己的帐户。
答:不。将 tar.gz 解压cd
到目录中,然后运行ls
.目录中有一个名为 的可执行文件ls
,它运行而不是/bin/ls
.它修改了您的计算机~/.bashrc
,因此下次您运行su
并输入 root 密码时,攻击者就拥有了您的计算机。
如果您想在当前目录中运行某些内容,请运行./cmd
答案2
事实证明,该问题既不是路径问题,也不是权限问题。 Anaconda Python 安装在我的 /root 目录中,这意味着它只能由超级用户访问。在家中重新安装 Anaconda 解决了问题。