总结:进普通用户出现-bash-4.1$的解决方法

1.每个用户都有的配置文件,只对单独的用户有效


.bash_profile:用户每次登录时执行
.bashrc:每次进入新的Bash环境时执行
.bash_logout:用户每次退出登录时执行
.bash_history  保存上次用户注销前使用的命令

[root@station6 tan]# ls -a
.   .bash_history  .bash_profile  er       .mozilla  san
..  .bash_logout   .bashrc        .gnome2  passwd    yi
[root@station6 tan]#

[root@station6 tan]# rm -rf .*
rm: 无法删除目录:"."
rm: 无法删除目录:".."
[root@station6 tan]# ls -a
.  ..  er  passwd  san  yi
[root@station6 tan]# su - tan
-bash-4.1$                               没有执行 .bash_profile  .bashrc 导致的结果

[root@station6 tan]# cp  -ir   /etc/skel/.bash*  /home/tan      再把那几个shell文件copy过去就可以了
[root@station6 tan]# su - tan
[tan@station6 ~]$

 

2.修改zhugeliang家目录的权限


[root@station6 ~]# chown -R root:root  /home/zhugeliang     -R recursive 递归修改权限为root
[root@station6 ~]# ll -d /home/zhugeliang
drwx------. 129 root root  12288 5月  24 19:51 /home/zhugeliang

[root@station6 ~]# su - zhugeliang
su: 警告:无法切换到目录/home/zhugeliang: 权限不够
-bash: /home/zhugeliang/.bash_profile: 权限不够
-bash-4.1$ mkdir s
mkdir: 无法创建目录"s": 权限不够
-bash-4.1$

[root@station6 ~]# chown -R zhugeliang:zhugeliang /home/zhugeliang   修改下权限

[root@station6 ~]# ll -d /home/zhugeliang
drwx------. 129 zhugeliang zhugeliang 12288 5月  24 19:51 /home/zhugeliang
[root@station6 ~]#

[root@station6 ~]# su - zhugeliang       这样就可以正常进入了
[zhugeliang@station6 ~]$

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值