Solved

Linux boot time question

Posted on 2011-02-28
8
263 Views
Last Modified: 2012-05-11
I have a pretty simple question, I need help in understanding the login process to be precise I want to know how is the lastlog printed upon login.
0
Comment
Question by:Peddu_bhanu
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 12

Expert Comment

by:upanwar
ID: 34997571
0
 
LVL 20

Expert Comment

by:edster9999
ID: 34997645
Linux does not do anything like this.

The GNU Linux Kernel is the heart inside linux that makes the system run.  Each distribution (each makers version of the linux system) has the commands and setup that those people design (or take from existing systems).

So where any commands like this are run and output on bootup / login are totally different depending on your distro.

If the commands run on boot look in :

/etc/conf.d/local.start
/etc/conf.d/local
/etc/init.d/local

If (as you are asking) it happens on login, check files like :

/etc/profile
/etc/login
/etc/bash/bashrc
/etc/bashrc

0
 
LVL 26

Expert Comment

by:lnkevin
ID: 35001445
lastlog normally tells you what user name has logged on from what computer or system. Normally, it would give you a fully qualified name from the computer where you access from.

Run this command:

cat /var/log/lastlog

or

tail /var/log/lastlog

K
0
 
LVL 3

Expert Comment

by:Alberto Cortes
ID: 35003036
The /var/log/lastlog file is a database which contains info on the last login of each user. You should not rotate it. It is a sparse file, so its size on the disk is usually much smaller than the one shown by "ls -l". You cannot display it using "cat" or "tail".

Use next syntax:
       lastlog [options]

Options:
  -b, --before DAYS     print only lastlog records older than DAYS
  -h, --help            display this help message and exit
  -t, --time DAYS       print only lastlog records more recent than DAYS
  -u, --user LOGIN      print lastlog record for user with specified LOGIN
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 1

Author Comment

by:Peddu_bhanu
ID: 35005041
Thank you for your replies, I m still not clear that after the authentication when /etc/profile or $HOME/.bash_profile & .bashrc or /etc/bashrc is run which specific part of the code calls for last log.

I know that we may disable it with $HOME/.hushlogin or hae our own custom scripts in /etc/profile.d/.

I would like to know how/which part of the code in profile or sysconfig/functions displays lastlog upon login.

I have checked with almost the entire /etc direcotry for any pattern "lastlog" in any file.I found none.

Any ideas.

Thanks in advance
Bhanu  
0
 
LVL 12

Accepted Solution

by:
upanwar earned 500 total points
ID: 35005901
I have found something for you.

The getty(1m) man-page contains a list of the different information that you can include with the login: prompt. If you are providing PPP services, I recommend that you do not cahnge anything in your login prompt, such as the date/time or the port name. This makes creating chat scripts difficult, as the users trying to login will not know what to expect.

At this point, we are left with the last login messages. Unfortunately, these are not contained in files that are as easily removed as /etc/motd and /etc/issue. However, by creating a file, the file .hushlogin in your home directory, we can remove them. It has no contents; rather, the existence of this file is the key. You can create it simply by changing to a users home directory (yours, if you are that user) and running

touch .hushlogin

Often administrators want to keep users' knowledge of the system as limited as possible. This is particularly important for systems with a high level of security in which users start applications and never see the shell prompt. One give-away to what kind of system you are on is the following line when you login:



Here is the complete article:

http://www.linux-tutorial.info/modules.php?name=MContent&pageid=70

0
 
LVL 1

Author Comment

by:Peddu_bhanu
ID: 35067842
Nothing has answered my question ,though close to it.Unfortunately we o not have anything concrete which can be pointed out in terms of printing that output.
0
 
LVL 20

Expert Comment

by:edster9999
ID: 35073099
As above... every distro is different and does things in different ways and in different places.
Give us a clue and tell us which distribution (and version) you are running.

other wise you are saying 'tell me exactly how my car operates'.
We can give you a rough idea as all cars have 4 wheels (well most do) and all have doors and windows etc but if you want detailed specifics you are going to have to give US some more info.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now