Steps after username and password is entered !


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Steps after username and password is entered !
# 1  
Old 06-12-2013
Steps after username and password is entered !

Hi,

I know this sounds crazy question.. but I am just curious to know what happens next when I enter username and password and hit enter on a new Unix session (using Putty)? I mean which file gets executed, how the default login shell is determined etc...

regards
juzz4fun
# 2  
Old 06-12-2013
If you login to a local terminal, you talk to /bin/login, if you login with sshd it goes its own way, but these days everything talks to the same login system -- pam. (pluggable authentication modules) It's not a program, it's a library, and it's very very picky about what it talks to, all controlled by configuration files under /etc/pam.d/

It's very configurable, but you mostly see it used the traditional way, where it checks /etc/passwd for login information and /etc/shadow for passwords.

/etc/passwd is where things like the location of your home folder and your default shell are stored. It can be read by anyone. /etc/shadow, readable only by root, is where hashed passwords are stored -- passwords go through a one-way function like md5 or sha to scramble them. You can't turn it back into a password, you can only compare two hashes to see if they're the same. (And even that takes some effort, because pam 'salts' them with a small random string.)

Still, hashed passwords aren't invulnerable. With enough computing power, you can hash millions of possible passwords until you find a match. This is why the 'passwd' file doesn't contain passwords anymore; as computers became more powerful, the hashed passwords required better protection.

So pam compares the hash of the password you typed with the stored hash to see if they match, and if they do, makes the setuid() system call to change its process ID into a different user, and following that, executes your shell.
These 3 Users Gave Thanks to Corona688 For This Post:
# 3  
Old 06-13-2013
Wow... you are something, Corona688 ! Smilie

Just wondering... the /etc/passwd file doesn't contain anything related to my userid/home dir/default shell... but it does contain info related to couple of other folks who works with me as system admin....
Once default shell is executed, .profile file is read... I know I can modify my .profile file to contain exec bash to use bash instead of default ksh
I was thinking if I can make bash a default shell itself...

Anyway, thank you for the information you provided.
# 4  
Old 06-13-2013
So you connect using LDAP or NIS (NIS+) and the information is written elsewhere...
You didnt say what system the remote host was...
# 5  
Old 06-13-2013
Apologies !
I was looking at old passwd file.... new file does contain the required information...
Thanks everyone...
# 6  
Old 06-13-2013
Quote:
Originally Posted by juzz4fun
Once default shell is executed, .profile file is read... I know I can modify my .profile file to contain exec bash to use bash instead of default ksh
I was thinking if I can make bash a default shell itself...
You can use chsh to change your default login shell.

Regards,
Alister
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Need to crack username and password on laptop

I am not a computer geek but I recently was given a Dell Latitude c400 laptop which has Red Hat Linux 2.4.20-6 GRUB Version 0.93. First of all I have no clue how to even use this operating system and I was never given the username or password. Is there anyone out there who could possibly help me... (4 Replies)
Discussion started by: missfixit74
4 Replies

2. UNIX for Dummies Questions & Answers

How do you reset username/password

Picked up a 3b2 running System V. Works fine, but it requires a username and password. Is the username "root" or "sysadm"? How do I find out and how to I reset it or bypass it? Thanks. (2 Replies)
Discussion started by: TanRuNomad
2 Replies

3. Shell Programming and Scripting

Username and password

Hi I am new to using unix and am struggling with a script i am writing. What i am trying to do is get a user to enter a username, check the original file i created with username and pin to see if their is a corresponding entry. Next ask the user to enter the pin and see if this matches... (5 Replies)
Discussion started by: somersetdan
5 Replies

4. Shell Programming and Scripting

Username password asked during loging

Hi, Whenever I open my unix box,after providing username and password I get the following message. Are you authorised to use this computer as detailed above? (Y)es/(N)o : y Export: Release 10.2.0.2.0 - Production on Mon May 16 16:00:15 2011 Copyright (c) 1982, 2005, Oracle. All rights... (5 Replies)
Discussion started by: emilybose
5 Replies

5. UNIX for Dummies Questions & Answers

How can i hide username/password

hi all, i run sqlplus command on unix(HP-UX) like "sqlplus username/password@serverA @deneme.sql" but when someone run "ps -ef | grep sqlplus", it can see my username and password :( How can i hide username and password. thanx. (1 Reply)
Discussion started by: temhem
1 Replies

6. UNIX for Dummies Questions & Answers

Shell program with username and password

Hi I am new to unix and I am trying to figure out how to write a shell script with a login name and password. I want to do something along the lines of if both are correct it echoes "you are logged in" and if the password is wrong it echoes "wrong password" and same with the login name. I've tried... (7 Replies)
Discussion started by: thedemonhunter
7 Replies

7. Red Hat

Trouble logging in with username and password

I have a RHEL 5 server that I can log into with an LDAP account hosted on a server running Sun DSEE 6.3 with an ssh key pair but not with my username and password. When I try to login to the console I am given the "login incorrect" message as if I fat fingered my password. Other users with... (5 Replies)
Discussion started by: ilikecows
5 Replies

8. Shell Programming and Scripting

wget with embedded username/password

Hi, I am encoding the username and password to the url and use it with wget. I.e wget ftp://username:password@myserver.com/test.mp3 However this does not work if the password contains @ character. if the password contains @, then the encoded url becomes wget... (1 Reply)
Discussion started by: learn more
1 Replies

9. Shell Programming and Scripting

username password in script

Can we write a script to telnet to a unix server from unix with the username and password hardcoded in the script?? something like ssh a@b -p password ??? (5 Replies)
Discussion started by: roshanjain2
5 Replies

10. UNIX for Dummies Questions & Answers

redirecting password as username for rlogin

Is the following even possible ? by echo $3, I mean enter password when prompted for it. My main issue is that it would deal with a prompted password, which is passed from the command line like this: ./processing serverA user password I cannot not use expect here, I heard that was very... (1 Reply)
Discussion started by: seaten
1 Replies
Login or Register to Ask a Question