# 1. 以 root 或其他用户登录
ssh root@服务器IP
# 或
ssh 其他用户@服务器IP
# 2. 修复 bvbej 用户的配置文件
sudo -i # 切换到 root
cd /home/bvbej
# 3. 删除或重命名有问题的文件
mv .bashrc .bashrc.broken
mv .profile .profile.broken
mv .bash_profile .bash_profile.broken 2>/dev/null
# 4. 从 /etc/skel 复制默认配置(最安全的方法)
cp /etc/skel/.bashrc .
cp /etc/skel/.profile .
cp /etc/skel/.bash_logout . 2>/dev/null
# 5. 设置正确的权限
chown bvbej:bvbej .bashrc .profile .bash_logout
chmod 644 .bashrc .profile .bash_logout
# 6. 测试
sudo -u bvbej bash -c 'source ~/.bashrc && echo "PATH: $PATH" && ls'
版权归属:
BvBeJ
许可协议:
本文使用《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》协议授权
评论区