遇到开机成功输入密码后无法进入桌面(无线循环提示输入密码)。可能是由于改动/etc/profile导致的,此时可以重新启动计算机在系统选择的时候选择advanced选项进入无界面终端模式。
使用命令
vim /etc/profile
打开profile文件将文件还原为初始状态(一般的可能是因为添加了export导入新环境变量)
直接复制一下配置文件覆盖原配置即可
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
export PATH
if [ "${PS1-}" ]; then
if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1='\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
一般linux修改环境变量请在根目录中的.bashrc文件中更改