Solved

Linux boot time question

Posted on 2011-02-28
8
264 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
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
 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
php ssh2_scp_send 1 60
how to rebuild XFS volume from LV 19 62
Coding C# in Linux 8 60
Bash script - Exit out of choice loop 2 23
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Fine Tune your automatic Updates for Ubuntu / Debian
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

816 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

12 Experts available now in Live!

Get 1:1 Help Now