Sponsored Content
Homework and Emergencies Homework & Coursework Questions Help with unix commands for user logins Post 302636007 by bakunin on Monday 7th of May 2012 01:01:42 AM
Old 05-07-2012
Quote:
Originally Posted by iw2198
Im using the bash shell and Im on a Linux os.
Two hints: Suppose you go to the car shop to buy some replacement part. If the dealer asks you which car it is you don't answer "a red one" or "a Ford". You tell him the exact model and the year it was built.

If you are asked about the OS you don't answer "Linux", but ideally the output of uname -a, eventually followed by the distribution and version. For instance:

Code:
Linux brecht 2.6.35-22-generic #33-Ubuntu SMP Sun Sep 19 20:32:27 UTC 2010 x86_64 GNU/Linux

This tells the kernel version (2.6.35-22), that it is a 64-bit system (x86_64) and the distribution (Ubuntu), from the kernel version one can deduce that it is Ubuntu 10.04.

The second hint: are you sure you read the right man page? Maybe man pages are not installed (install them) or are not installed properly? Are they indexed correctly? (I am not sure if this is necessary in Linux - in AIX after installing man pages root is supposed to issue catman -w.)

Just to make sure we talk about the same: this is the page you should see:

Code:
# man last
LAST,LASTB(1)                  Linux System Administrator's Manual                  LAST,LASTB(1)

NAME
       last, lastb - show listing of last logged in users

SYNOPSIS
       last  [-R]  [-num]  [  -n  num  ]  [-adFiox]  [  -f file ] [ -t YYYYMMDDHHMMSS ] [name...]
       [tty...]
       lastb [-R] [-num] [ -n num ] [ -f file ] [-adFiox] [name...]  [tty...]

DESCRIPTION
       Last searches back through the file /var/log/wtmp (or the file designated by the -f  flag)
       and  displays  a list of all users logged in (and out) since that file was created.  Names
       of users and tty's can be given, in which case last will show only those entries  matching
       the arguments.  Names of ttys can be abbreviated, thus last 0 is the same as last tty0.

       When last catches a SIGINT signal (generated by the interrupt key, usually control-C) or a
       SIGQUIT signal (generated by the quit key, usually control-\), last will show how  far  it
       has searched through the file; in the case of the SIGINT signal last will then terminate.

       The  pseudo  user  reboot logs in each time the system is rebooted.  Thus last reboot will
       show a log of all reboots since the log file was created.

       Lastb is the  same  as  last,  except  that  by  default  it  shows  a  log  of  the  file
       /var/log/btmp, which contains all the bad login attempts.

OPTIONS
       -f file
              Tells last to use a specific file instead of /var/log/wtmp.

       -num   This is a count telling last how many lines to show.

       -n num The same.

       -t YYYYMMDDHHMMSS
              Display  the  state  of  logins as of the specified time.  This is useful, e.g., to
              determine easily who was logged in at a particular time -- specify that  time  with
              -t and look for "still logged in".

       -R     Suppresses the display of the hostname field.

       -a     Display the hostname in the last column. Useful in combination with the next flag.

       -d     For  non-local  logins,  Linux stores not only the host name of the remote host but
              its IP number as well. This option translates the IP number back into a hostname.

       -F     Print full login and logout times and dates.

       -i     This option is like -d in that it displays the IP number of the remote host, but it
              displays the IP number in numbers-and-dots notation.
       -o     Read an old-type wtmp file (written by linux-libc5 applications).

       -x     Display the system shutdown entries and run level changes.

NOTES
       The  files  wtmp  and  btmp  might not be found. The system only logs information in these
       files if they are present. This is a local configuration issue. If you want the  files  to
       be  used,  they  can  be  created  with  a  simple  touch(1)  command  (for example, touch
       /var/log/wtmp).

FILES
       /var/log/wtmp
       /var/log/btmp

AUTHOR
       Miquel van Smoorenburg, miquels@cistron.nl

SEE ALSO
       shutdown(8), login(1), init(8)

                                           Jul 31, 2004                             LAST,LASTB(1)

I hope this helps.

bakunin
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Trapping user logins in python ( post #1)

I am writting a daemon in python which should start at system start up with all inet.d services on an NIS server. Then it should listen to any user login and then start a new process for that user on his login which will continue throughout his entire session. Can anyone give any help or any... (1 Reply)
Discussion started by: thinkgeek
1 Replies

2. UNIX for Dummies Questions & Answers

Linmit user logins

Hello everyone, traditionally a user can log in on more than one machine as much as they want. In AIX 4.3, Is there a way to make it so that if the user is already logged on, the system will not let them log on, therefor not run their logon profile script again? (limit the user to one machine at a... (1 Reply)
Discussion started by: raidzero
1 Replies

3. Solaris

stay in multi user mode but stop logins to system?

I want to apply patches in multiuser mode but stop logins of other users while I do it? What is the best way to do this? I will be connected to the system via a putty session over a serial cable from another system (console is messed up)... Should I put in a dummy passwd and shadow file... (7 Replies)
Discussion started by: NewSolarisAdmin
7 Replies

4. AIX

Logging user logins

I want to know how I can turn off and turn on login logging. We have a server that appears to have stopped logging user logins. Running the who command shows nothing and the last command shows no logins for a month. The var/adm/wtmp file isn't full and there is plenty of space in the var file... (2 Replies)
Discussion started by: daveisme
2 Replies

5. Solaris

User Logins

Is the below logins are needed in the machine..... nuucp , uucp ,smmsp , svctag , listen , webservd , ip ( We are not using printers), Can you help in these? Regards, kumar (3 Replies)
Discussion started by: rajeshkumarvg
3 Replies

6. Shell Programming and Scripting

Script that outputs user logins sorted by duration

Hello, I want to write a script that takes a username as input and outputs the user's logins sorted by duration. Also I want to exclude the "still logged in" entries. I use the "last" command but Im having problems sorting the entries based on the duration. Can you help me? Thanks a lot =) (4 Replies)
Discussion started by: ddante
4 Replies

7. Solaris

Configure Solaris to accept Active Directory user logins

Is it possible to configure a Solaris server to authenticate users against an Active Directory server when logging in via ssh? I've seen some docs out there, I've followed their instructions, but it does not work. And I'm beginning to wonder if it is possible or even supported by Oracle. The... (2 Replies)
Discussion started by: BG_JrAdmin
2 Replies

8. Red Hat

Limit root user of SSH logins

Hi team, I tried to modify the /etc/security/limits.conf file to limit the root user for more one login. I added the line in limits.conf file like: @root hard maxlogins 1 I also tried to modify /etc/ssh/sshd_config to limit the root userlogin by adding this: ... (10 Replies)
Discussion started by: leo_ultra_leo
10 Replies

9. Solaris

[Resolved] Strange Issue with user logins

Ok got a strange one here. None of my user accounts are able to login into the system. When trying to ssh to the server i get the following. Could not chdir to home directory /home/<homedir>: Permission denied /bin/sh: Permission denied I checked the permissions on the home directory and even... (7 Replies)
Discussion started by: JoeDirte
7 Replies

10. UNIX for Beginners Questions & Answers

Disable multiple ssh logins for an OS user in Solaris

Hi folks, I am fairly a beginner when it comes to Solaris OS administration, but part of my job somehow has scope to provide L1-level of OS administration over a few solaris servers. Now, we have a requirement to limit the number of simultaneous ssh logins/sessions to the server, sort of... (0 Replies)
Discussion started by: engrcha
0 Replies
All times are GMT -4. The time now is 06:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy