#出现这种情况可能就是用户的环境变量配置文件被删了
[root@localhost liyi]# su - liyi
-bash-4.1$
-bash-4.1$
-bash-4.1$ exit
logout
#用root登录到/etc/skel/
[root@localhost liyi]#
[root@localhost liyi]# cd /etc/skel/
[root@localhost skel]# ll -a
total 36
drwxr-xr-x. 4 root root 4096 Jul 11 17:39 .
drwxr-xr-x. 106 root root 12288 Aug 14 18:49 …
-rw-r–r--. 1 root root 18 Jul 18 2013 .bash_logout
-rw-r–r--. 1 root root 176 Jul 18 2013 .bash_profile
-rw-r–r--. 1 root root 124 Jul 18 2013 .bashrc
drwxr-xr-x. 2 root root 4096 Nov 12 2010 .gnome2
drwxr-xr-x. 4 root root 4096 Jul 11 17:36 .mozilla
#复制/etc/skel/的隐藏文件到用户家目录
#注意隐藏文件的拷贝方式cp -a ./.
[root@localhost skel]# cp -a ./. /home/liyi/
#切换测试,发现成功
[root@localhost skel]# su - liyi
[liyi@localhost ~]$
来源:CSDN
作者:qq_43073985
链接:https://blog.csdn.net/qq_43073985/article/details/104215939