登录后终端显示 bash-4.2# 解决办法

登录后终端显示 bash-4.2# 解决办法

如下所示,登录后,显示 bash-4.2#,而不是 root@hostname path

# docker exec -it 2062768eb5a0 /bin/bash
bash-4.2#

上述情况是因为该用户的根目录下缺失必要的配置文件,故解决方法为:

# cd /etc/skel
# ls -a
.  ..  .bash_logout  .bash_profile  .bashrc
# cp .bash_profile /root/
# cp .bashrc /root/

如果是普通用户,将配置文件拷贝到该用户根目录下即可。

重新登录后,显示正常:

bash-4.2# exit
exit
[root@hostname ~]# docker exec -it 2062768eb5a0 /bin/bash
[root@2062768eb5a0 /]# 

参考文档:https://www.cnblogs.com/origalom/p/8444382.html

posted @ 2020-03-26 17:32  百变小怪兽  阅读(3067)  评论(0编辑  收藏  举报