Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

So I've been getting more and more into my UNIX system, a mac, and I wanted to know where it goes to execute a log-in. I know where it keeps the passwords and such, but I would like to see the script it runs at log-in. I did find /usr/bin/login but neither vim nor nano will show anything that looks like code(eg. it's 90% @ symbols). So if that is the file how can I read it?

share|improve this question
    
Is this what you're looking for: stackoverflow.com/a/97164/490315 ? –  whirlwin Mar 21 '13 at 23:12
    
The "@symbols" you saw mean that /usr/bin/login is actually a binary file. You should try looking for its source code in your repos. –  Joseph R. Mar 21 '13 at 23:14
    
@whirlwin Not exactly, I'm trying to see what Unix does to start up, so then I can get greater knowledge about Unix –  Hovestar Mar 21 '13 at 23:18
4  
Despite the fact that OSX is POSIX-compliant and SUS certified, I personally would look in other places for things to learn. For example Linux, BSD or (Open)Solaris. All very easy to install via VM. Just my 2 cents. –  schaiba Mar 21 '13 at 23:40
1  
The graphical login components of OSX aren't open source, so it's unlikely you'll be able to see the source of it (and do you know Objective C? Because that's likely what its written in). OSX isn't a great place to start learning about the internals of the OS due to its closed source, try Linux or one of the BSDs. –  jsbillings Mar 22 '13 at 12:36
show 3 more comments

2 Answers

It depends... if you start a console login, a program usually called getty (in Fedora Linux, agetty(8)) shows the login: prompt, asks for the username and passes that to login(1), which gets the user's information, asks for the password and (if successful) sets up the environment and starts a shell for the user. The login program is quite standard, the Linux one is part of the util-linux package. The FreeBSD version is here (that is probably nearer the MacOS one than the Linux version).

For a graphical login, there is a greeter program like xdm(1) or something more elaborate like gdm, which does most of the above, but starts an X session with predefined programs running.

share|improve this answer
add comment

As you are running Mac OSX, you can use dtrace execsnoop in a terminal to see all commands executed:

nohup sudo execsnoop -v > /var/tmp/execsnoop.log &

Then logout and login and you'll see what your OS is running.

You might modify this dtrace script for it to use anonymous tracing and then see all programs executed while your OS is booting.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.