首页 > 系统服务 > 详细

Linux运维系统工程师系列---04

时间:2014-03-31 09:29:22      阅读:586      评论:0      收藏:0      [点我收藏+]

和用户登录相关的文件

   

用户登录是需要读取的文件

1、/etc/profile

2、/etc/bashrc

3、/etc/profile.d/*

4、~user/.bashrc

5、~user/.bash_profile


登录shell和非登录shell:

[root@localhost ~]# su - usr4登录shell

[root@localhost ~]# su usr4非登录shell

非登录shell使用的是别人的环境变量


演示登录shell和非登录shell执行了哪些文件

在以下4个文件的最前和最后分别加上

[root@localhost profile.d]# vim /etc/profile

echo "/etc/profile begin"

echo "/etc/profile end"

[root@localhost profile.d]# vim /etc/bashrc

echo "/etc/bashrc begin"

echo "/etc/bashrc end"

[root@localhost profile.d]# vim /home/usr4/.bashrc

echo "/home/usr4/.bashrc begin"

echo "/home/usr4/.bashrc end"

[root@localhost profile.d]# vim /home/usr4/.bash_profile

echo "/home/usr4/.bash_profile begin"

echo "/home/usr4/.bash_profile end"

[root@localhost profile.d]# pwd

/etc/profile.d

[root@localhost profile.d]# vim test.sh

#! /bin/bash

echo "/etc/profile.d"

验证登录shell和非登录shell执行的文件有何区别?

登录shell

[root@localhost usr4]# su - usr4

/etc/profile begin

/etc/profile.d

/etc/profile end

/home/usr4/.bash_profile begin

/home/user4/.bashrc begin

/etc/bashrc begin

/etc/bashrc end

/home/usr4/.bashrc end

/home/usr4/.bash_profile end

非登录shell

[root@localhost usr4]# su usr4

/home/usr4/.bashrc begin

/etc/bashrc begin

/etc/profile.d

/etc/bashrc end

/home/usr4/.bashrc end





本文出自 “空谷幽兰” 博客,请务必保留此出处http://2489843.blog.51cto.com/2479843/1387230

Linux运维系统工程师系列---04,布布扣,bubuko.com

Linux运维系统工程师系列---04

原文:http://2489843.blog.51cto.com/2479843/1387230

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!