1,695   Linux

Linux新建用户后,su 进去,命令行显示如下

bash-4.1$

并不是我们熟悉的格式 username@hostip
这是因为新建用户没有 .bash_profile 文件导致的问题

解决方法:
1,在root用户下,进入新建用户比如 username 的指定home目录,这里是 /home/username
2,然后新建文件 .bash_profile ,并输入内容 export PS1='[\u@\h \W]\$’
3,最后返回新建用户下,执行 source ~/.bash_profile

熟悉的命令行画面又出现了




Leave a Reply

Your email address will not be published. Required fields are marked *