Solved

Linux boot time question

Posted on 2011-02-28
8
262 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

762 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

19 Experts available now in Live!

Get 1:1 Help Now