Linux运维系统工程师系列04

本文发布时间: 2019-Mar-22
和用户登录相关的文件用户登录是需要读取的文件1、/etc/profile2、/etc/bashrc3、/etc/profile.d/*4、~user/.bashrc5、~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/profileecho "/etc/profile begin"echo "/etc/profile end"[root@localhost profile.d]# vim /etc/bashrcecho "/etc/bashrc begin"echo "/etc/bashrc end"[root@localhost profile.d]# vim /home/usr4/.bashrcecho "/home/usr4/.bashrc begin"echo "/home/usr4/.bashrc end"[root@localhost profile.d]# vim /home/usr4/.bash_profileecho "/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/bashecho "/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


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2024-Mar-04 02:10pm
栏目列表