美文网首页
Linux 切换用户出现“-bash-4.2$”

Linux 切换用户出现“-bash-4.2$”

作者: 都市小木屋 | 来源:发表于2019-12-19 14:49 被阅读0次

问题原因:
用户丢失家目录下的环境变量文件:.bash_profile、.bashrc、.bash_logout

解决方式:

如切换到postgres用户:

[root@localhost ~]# su - postgres
Last login: Fri Apr 10 21:02:21 CST 2020 on pts/4
-bash-4.2$

则copy相关文件到postgres用户家目录下:

[root@localhost ~]# cp /etc/skel/.bash_logout /home/postgres/
[root@localhost ~]# cp /etc/skel/.bash_profile /home/postgres/
[root@localhost ~]# cp /etc/skel/.bashrc /home/postgres/

重新切换至用户 postgres用户

[root@localhost ~]# su - postgres
Last login: Fri Apr 10 21:04:23 CST 2020 on pts/4
[postgres@localhost root]$

以上

相关文章

网友评论

      本文标题:Linux 切换用户出现“-bash-4.2$”

      本文链接:https://www.haomeiwen.com/subject/trbmnctx.html