一个用户登录会有哪些流程?

詹姆斯大胡子 -
一个用户登录会有哪些流程?
The Login Process

The following step-by-step description shows what happens each time a user logs in to a UNIX computer system.

Users enters their username.User enters their password.The operating system confirms your name and password.A "shell" is created for you based on your entry in the "/etc/passwd" file (in small businesses, this is usually a Bourne Shell).You are "placed" in your "home"directory.Startup information is read from the file named "/etc/profile". This file is known as the system login file. When every user logs in, they read the information in this file.Additional information is read from the file named ".profile" that is located in your "home" directory. This file is known as your personal login file. (This is the file that usually contains the "menu" program.)/etc/profile和/etc/bashrc傻傻分不清楚?profile

profile 是某个用户唯一的用来设置环境变量的地方, 因为用户可以有多个 shell 比如 bash, sh, zsh 之类的, 但像环境变量这种其实只需要在统一的一个地方初始化就可以了, 而这就是 profile.

bashrc rc--RunCom

是专门用来给 bash 做初始化的比如用来初始化 bash 的设置, bash 的代码补全, bash 的别名, bash 的颜色. 以此类推也就还会有 shrc, zshrc 这样的文件存在了, 只是 bash 太常用了而已.

tips:

source命令简介
在当前Shell环境中从指定文件读取和执行命令

摘要
source filename [arguments]

参数
filename:要执行的文件

arguments(可选):传递给文件的参数

返回值
source返回文件最后一个命令的返回值,如果文件不能读取则会失败

参考资料

https://alvinalexander.com/un...
https://www.linuxprobe.com/di...

特别申明:本文内容来源网络,版权归原作者所有,如有侵权请立即与我们联系(cy198701067573@163.com),我们将及时处理。

Tags 标签

linux

扩展阅读

加个好友,技术交流

1628738909466805.jpg