除非运行"bash"命令,否则在SU或SSH登录后BASH和/或.BASHRC无法正常工作

Mik*_*key 15 linux bash ubuntu amazon-ec2

我有一台运行Ubuntu 10.04的Amazon EC2机器.

默认用户,ubuntu .bashrc似乎行为正常,但如果我sshsu第二个用户mikey,它在我运行之前无法正常显示bash:

例1.)用户改变用户 su

mikey@home ~$ ssh ubuntu@EC2
ubuntu@EC2:~$
ubuntu@EC2:~$ su mikey
$ 
$ bash
mikey@EC2: $
Run Code Online (Sandbox Code Playgroud)

例2.)直接以用户身份SSH

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:~$
Run Code Online (Sandbox Code Playgroud)

我试过玩~/.profile~/.bash_login包括

if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
Run Code Online (Sandbox Code Playgroud)

但到目前为止,似乎没有什么可以做到的.

任何指针将不胜感激.谢谢!

Dan*_*ego 37

事实上,如果你的shell没有bash,你可以尝试改变它:

usermod -s /bin/bash mikey
Run Code Online (Sandbox Code Playgroud)

如果/ bin/bash是该bash系统的位置.