现在的位置: 首页 > 综合 > 正文

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

2014年02月20日 ⁄ 综合 ⁄ 共 1173字 ⁄ 字号 评论关闭

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 ~]$

 

抱歉!评论已关闭.