Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
07-19-2004, 08:23 PM
|
#1
|
Member
Registered: Apr 2004
Location: M'sia, Aus, Chn
Distribution: Redhat Linux 8 & 9, Fedora Core 2, XP
Posts: 301
Rep:
|
Tracing which user logs onto which PC
G'day~
I am just wondering whether is it possible to trace which user logs onto which PC on a network. Any log files that I should be looking at?
I only know that Samba's log files are stored in /var/log/samba and I have basically looked at most of them but they do not seem to contain the info i am looking for...
My system is a RH9 running Samba acting as the PDC with Windows XP boxes as clients.
I am trying to hook up Nagios though... this program really needs some serious configuration in order to work!
Alrighty, thanks in advance~
~WiLL~
|
|
|
07-19-2004, 09:16 PM
|
#2
|
Member
Registered: Sep 2002
Location: .at
Distribution: SuSE, Knoppix
Posts: 532
Rep:
|
1) check /var/log/messages for logins
2) use the "last" command (man last)
3) install the accounting package (man accton)
|
|
|
07-19-2004, 10:49 PM
|
#3
|
Member
Registered: Oct 2003
Location: USA
Distribution: Red Hat 9, Ubuntu 10; Windows Server 2003 and XP
Posts: 34
Rep:
|
I agree Nagios does take some serious configuration to get going, but if you just do a little reading on the instructions its not that bad. And once you get it going it's great.
|
|
|
07-20-2004, 02:12 AM
|
#4
|
Member
Registered: Apr 2004
Location: M'sia, Aus, Chn
Distribution: Redhat Linux 8 & 9, Fedora Core 2, XP
Posts: 301
Original Poster
Rep:
|
Thanks for the prompt reply~
Here is my results, maybe you can give me more advice:
1) last few lines of my /var/log/messages
Code:
Jul 20 15:05:22 redhat32 smbd[4888]: [2004/07/20 15:05:22, 0] rpc_server/srv_pipe.c:api_pipe_netsec_process(1397)
Jul 20 15:05:22 redhat32 smbd[4888]: failed to decode PDU
Jul 20 15:05:22 redhat32 smbd[4888]: [2004/07/20 15:05:22, 0] rpc_server/srv_pipe_hnd.c:process_request_pdu(605)
Jul 20 15:05:22 redhat32 smbd[4888]: process_request_pdu: failed to do schannel processing.
Jul 20 15:05:23 redhat32 smbd[4888]: [2004/07/20 15:05:23, 0] smbd/service.c:set_current_service(56)
Jul 20 15:05:23 redhat32 smbd[4888]: chdir (/home/samba/netlogon) failed
Jul 20 15:05:24 redhat32 smbd[4888]: [2004/07/20 15:05:24, 0] smbd/service.c:set_current_service(56)
Jul 20 15:05:24 redhat32 smbd[4888]: chdir (/home/samba/netlogon) failed
Jul 20 15:05:33 redhat32 smbd[4888]: [2004/07/20 15:05:33, 0] rpc_server/srv_util.c:get_domain_user_groups(376)
Jul 20 15:05:33 redhat32 smbd[4888]: get_domain_user_groups: primary gid of user [redhat32admin] is not a Domain group !
Jul 20 15:05:33 redhat32 smbd[4888]: get_domain_user_groups: You should fix it, NT doesn't like that
OK, whats PDU? My netlogon is set to 0770...
Whats with the last 2 lines? Sounds funny
2) last seems to only show users that log into the server not the XP machines...
3) I do not have an accton, what is it anyway?
CheerS~
|
|
|
07-20-2004, 02:14 AM
|
#5
|
Member
Registered: Apr 2004
Location: M'sia, Aus, Chn
Distribution: Redhat Linux 8 & 9, Fedora Core 2, XP
Posts: 301
Original Poster
Rep:
|
Thanks, jpat1023 
|
|
|
07-20-2004, 09:16 PM
|
#6
|
Member
Registered: Apr 2004
Location: M'sia, Aus, Chn
Distribution: Redhat Linux 8 & 9, Fedora Core 2, XP
Posts: 301
Original Poster
Rep:
|
*bump*
|
|
|
07-21-2004, 10:58 PM
|
#7
|
Member
Registered: Apr 2004
Location: M'sia, Aus, Chn
Distribution: Redhat Linux 8 & 9, Fedora Core 2, XP
Posts: 301
Original Poster
Rep:
|
can anybody lend a hand with my problem here?
Thanks in advance~
|
|
|
08-03-2004, 10:01 AM
|
#8
|
Member
Registered: Apr 2004
Location: M'sia, Aus, Chn
Distribution: Redhat Linux 8 & 9, Fedora Core 2, XP
Posts: 301
Original Poster
Rep:
|
I thought of a way, just want some advice on this~
smbstatus is very useful in this sense since it outputs the username, group and machine logged onto the server...
i was thinking of using cron to periodically porting the output of smbstatus to a file.
Can anyone give me a hint on how this could be done?
I reckon that there is a better way of doing this, any suggestions welcome 
|
|
|
08-03-2004, 10:43 AM
|
#9
|
Member
Registered: Oct 2003
Posts: 54
Rep:
|
|
|
|
08-03-2004, 11:00 AM
|
#10
|
Member
Registered: Apr 2004
Location: M'sia, Aus, Chn
Distribution: Redhat Linux 8 & 9, Fedora Core 2, XP
Posts: 301
Original Poster
Rep:
|
The site looks promising... Thanks~ 
Last edited by kenji1903; 08-05-2004 at 10:27 PM.
|
|
|
08-05-2004, 10:28 PM
|
#11
|
Member
Registered: Apr 2004
Location: M'sia, Aus, Chn
Distribution: Redhat Linux 8 & 9, Fedora Core 2, XP
Posts: 301
Original Poster
Rep:
|
Tried the code that was on the site, modified the srv_netlog_nt.c in Samba, got errors when i execute the make command... I am bad programmer
Did you manage to get it to work, BrianWGray?
|
|
|
08-06-2004, 10:03 AM
|
#12
|
Member
Registered: Oct 2003
Posts: 54
Rep:
|
Honesty
I have to be honest, I use a windows advanced server as my domain controller. I have no need for the logs on the samba boxes because they authenticate to the domain controller every time they need to allow access.
I'm working on phasing out the windows servers so when I get to that stage I'll be sure to update my post. That won't be for a few months though.
|
|
|
08-06-2004, 10:59 PM
|
#13
|
Member
Registered: Apr 2004
Location: M'sia, Aus, Chn
Distribution: Redhat Linux 8 & 9, Fedora Core 2, XP
Posts: 301
Original Poster
Rep:
|
I see... does windows advanced server have an option to enable a log file of users logging on/off the server?
No worries mate, I will be waiting for your updates!
Thanks for the hints~ 
|
|
|
09-13-2004, 10:04 AM
|
#14
|
Member
Registered: May 2001
Location: Everett, WA
Distribution: Gentoo, RedHat
Posts: 102
Rep:
|
I have implemented a couple of basic scripts that will log who is logged on to which machines throughout the day. The problem with what I have done is that Samba does not seem to recognize that the users have logged off very well... This problem is most evident when my log files show that people have logged on through the weekend when nobody was here.
This script runs every minute via cron and logs who is currently logged into the domain controller:
Code:
#!/bin/bash
#
# This shell script will list all of the Samba users currently on-line
# who have signed into this Domain Controller.
#
# This script will compile a list of users who have been logged on to
# specific machines throughout the day.
#
# Author: Joshua Miller
# Date: 8/06/2004
CURDATE=`date +%m%d%Y-%H%M%S`
SUBNET='XXX.XXX'
SAVEFILE='/var/log/samba/smbusers.txt'
echo ""
echo "Username Machine"
echo "-------------------------------"
smbstatus | grep $SUBNET | awk '{printf "%s \t%s\n", $2, $4}' | sort -u | tee -a $SAVEFILE
echo "-------------------------------"
echo "Number of Users On-Line: "
smbstatus | grep $SUBNET | awk '{print $2}' | sort -u | wc -l
echo ""
# Do not store duplicate name/machine pairs in the file - save space
cat $SAVEFILE | sort -u > $SAVEFILE
Then, I have a script that runs daily to create a log of the users who have logged into each machine for that day. With the date setup that I have used, it is actually data for the previous day.
Code:
#!/bin/bash
CURDATE=`date +%m%d%Y`
SAVEFILE='/var/log/samba/smbusers.txt'
TEMPFILE='/var/log/samba/tmpusers.txt'
sort -u $SAVEFILE > $TEMPFILE
cp $TEMPFILE /var/log/samba/umlogs/$CURDATE-smbusers.txt
I am trying to figure out how to get Samba to logoff users more accurately, but until then, this is the best that I have. I hope that this helps.
Josh
|
|
|
All times are GMT -5. The time now is 05:03 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|