Operating System - Linux
1748166 Members
3799 Online
108758 Solutions
New Discussion юеВ

Re: what is login process in linux

 
avizen9
Esteemed Contributor

what is login process in linux

HI

can somebody tell me what exectly will heppen when we key in login name and password in linux box, what are the file will use what chacking will done, etc.. thanks,
6 REPLIES 6
Ivan Krastev
Honored Contributor

Re: what is login process in linux

avizen9
Esteemed Contributor

Re: what is login process in linux

i dont think this will help, already check this before post this question in forum.
Jared Middleton
Frequent Advisor

Re: what is login process in linux

The original question is very wide. You really should elaborate on your question, e.g.
Which linux version/distribution?
What login method/protocol (e.g. telnet, ssh, ftp)?
Which shell?

For example, if you're looking for which scripts get executed and what PATHs are used when logging into a RHEL 4 server via ssh into an account setup to use the bash login shell...

ssh login:
read /etc/pam.d/sshd
source /etc/environment
exec -/bin/bash

bash invoked by login shell:
source /etc/profile
source ~/.bash_profile
or ~./bash_login
or ~/.profile
...
source ~/.bash_logout

bash invoked by interactive non-login shell:
source ~/.bashrc

/etc/profile [System wide environment and startup programs, for login setup]
- if root, add to front of PATH: /usr/local/sbin:/usr/sbin:/sbin
- add to end of PATH: /usr/X11R6/bin
* add to end of PATH: /usr/local/bin
- source /etc/profile.d/*.sh

~/.bash_profile [Executed once upon logging in. Set environment variables. May produce output]
- source ~/.bashrc
- adds to end of PATH: $HOME/bin

~/.bashrc [Executed every time a shell starts. Set aliases and shell functions. Should never produce output.]
- source /etc/bashrc

/etc/bashrc [System wide functions and aliases, even for non-interactive, non-login shells]
- if not a login shell, source /etc/profile.d/*.sh

/etc/profile.d/krb5.sh
- add to front of PATH: /usr/kerberos/bin
- if root, add to front of PATH: /usr/kerberos/sbin

/etc/crontab
- PATH=/sbin:/bin:/usr/sbin:/usr/bin
* PATH=/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

[johndoe]$ echo $PATH
/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/johndoe/bin

--Jared
avizen9
Esteemed Contributor

Re: what is login process in linux

Hi Jared,
thanks,
what happen if we login through direct on console. ( not remotly) what are the files are used by system and what will be the process.

i am talking about direct login on server you are front of server.
Matti_Kurkela
Honored Contributor

Re: what is login process in linux

This is almost infinitely configurable, but I'll try to explain...

The program/process that displays the login prompt is usually some variation of "getty". If I recall correctly, the default on RedHat might be /sbin/agetty or /sbin/mingetty. The getty program is selected in /etc/inittab: that is the first place you should examine.

After the user has typed in his username, getty passes this information to the "login" process. The standard login process is /bin/login, but this can be changed by giving the appropriate options to the getty process in the /etc/inittab file.

If a non-default login process is used, anything can happen. From this point on, I assume standard /bin/login.

The /bin/login loads the PAM libraries specified in /etc/pam.d/login. These libraries will control the authentication and session setup. The standard configuration asks the user to type in a password, then uses /etc/passwd and /etc/shadow to check the validity of the username/password pair. If the password was wrong or the user account is expired, the authentication attempt will be rejected.

By changing PAM configuration (editing /etc/pam.d/login) this procedure can be drastically changed. If a smart-card authentication library is used, the system can require the user to insert a card to the reader and type in a PIN; if RADIUS authentication library is used, the system will send an authentication request to an external authentication server, which can then use whatever methods it has to authenticate the user. (I understand RSA SecurID authentication is often implemented using a RADIUS authentication server.)

After the PAM libraries have accepted your authentication, the session setup component of PAM initializes the basic environment (and optionally some ulimit settings, if configured). After all this, the login process will read your home directory and the pathname of your login shell from /etc/passwd and starts the shell for you.

After this, your login shell (usually bash) will run both system-wide and your personal login scripts and finally gives you a command prompt.

MK
MK
avizen9
Esteemed Contributor

Re: what is login process in linux

this answers are help me to know.