SU或SSH登录后,BASH和/或.BASHRC不能正常运行,除非运行"bash".命令 [英] BASH and/or .BASHRC not working properly after SU or SSH login unless run "bash" command
问题描述
我有一台运行Ubuntu 10.04的Amazon EC2计算机.
I have an Amazon EC2 Machine running Ubuntu 10.04.
默认用户ubuntu的.bashrc
似乎运行正常,但是如果我ssh
或su
到第二个用户mikey,则在我运行bash
之前它不会正确显示:
The default user, ubuntu's .bashrc
seems to be behaving properly, but if I ssh
or su
to the second user, mikey, it doesn't display properly until I run bash
:
Ex 1.)使用su
mikey@home ~$ ssh ubuntu@EC2
ubuntu@EC2:~$
ubuntu@EC2:~$ su mikey
$
$ bash
mikey@EC2: $
Ex 2.)以用户身份直接SSH-
Ex 2.) SSH-ing in directly as the user
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
但到目前为止,似乎还没有解决办法.
but so far, nothing has seemed to do the trick.
任何指针将不胜感激.谢谢!
any pointers would be greatly appreciated. thanks!
推荐答案
实际上,如果您的shell不是bash
,则可以尝试像这样更改它:
If, in fact, your shell isn't bash
, you can try to change it like so:
usermod -s /bin/bash mikey
如果/bin/bash是bash
在该系统上的位置.
If /bin/bash is the location of bash
on that system.
这篇关于SU或SSH登录后,BASH和/或.BASHRC不能正常运行,除非运行"bash".命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!