我有一台运行Ubuntu 10.04的Amazon EC2计算机。
默认用户ubuntu的.bashrc
似乎运行正常,但是如果我将ssh
或su
分配给第二个用户mikey,则在我运行bash
之前,它不会正确显示:
示例1.)使用su
更改用户
mikey@home ~$ ssh ubuntu@EC2
ubuntu@EC2:~$
ubuntu@EC2:~$ su mikey
$
$ bash
mikey@EC2: $
示例2。)以用户身份直接SSH-ing
mikey@home ~$ ssh mikey@EC2
/home/mikey/.bashrc: 13: shopt: not found
/home/mikey/.bashrc: 21: shopt: not found
/home/mikey/.bashrc: 99: shopt: not found
/etc/bash_completion: 33: [[: not found
/etc/bash_completion: 39: [[: not found
/etc/bash_completion: 52: Bad substitution
\[\e]0;\u@\h: \w\a\]\u@\h:\w$
\[\e]0;\u@\h: \w\a\]\u@\h:\w$ bash
mikey@EC2:~$
我尝试过使用
~/.profile
和~/.bash_login
包括if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
但到目前为止,似乎没有任何办法可以解决。
任何指针将不胜感激。谢谢!
最佳答案
如果实际上您的 shell 不是bash
,则可以尝试如下更改它:
usermod -s /bin/bash mikey
如果/bin/bash是
bash
在该系统上的位置。关于linux - SU或SSH登录后BASH和/或.BASHRC无法正常运行,除非运行 “bash”命令,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8607473/