LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-17-2010, 03:02 PM   #1
bkone
Member
 
Registered: Jun 2006
Distribution: SUSE, Red Hat, Oracle Linux, CentOS
Posts: 108

Rep: Reputation: 15
Obtain local user accounts remotely


I am trying to figure out a way to pull the user information from local users on a Linux server. I have approximately 40 servers running SUSE and Ubuntu that are using Microsoft Active Directory in order to authenticate. Our internal auditing group has made us disable root ssh ability, I was doing this with clusterssh, but I can login as me then su on the server to conduct root, admin, work. This is an ongoing request to get the local users and it is a painfully slow process since I have to login to each server to get the /etc/passwd file. Is there another way to get the local user information? They are now asking about seeing the last logon date or if the account is disabled, any thoughts there as well?

Most of our auditors think Windows and I am trying to make my life easier but not sure what options I have. I need to get local accounts and if they are active or disabled plus last logon date. I'm sure there will be more but if I can get the basics adding more shouldn't be too difficult but I guess I'll cross that bride when I get there. Oh yeah, any way to just pick out the local users and not the service daemons would also be helpful.

Any and all feedback welcomed. I am at a loss!
 
Old 08-17-2010, 11:48 PM   #2
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by bkone View Post
I am trying to figure out a way to pull the user information from local users on a Linux server. I have approximately 40 servers running SUSE and Ubuntu that are using Microsoft Active Directory in order to authenticate. Our internal auditing group has made us disable root ssh ability, I was doing this with clusterssh, but I can login as me then su on the server to conduct root, admin, work. This is an ongoing request to get the local users and it is a painfully slow process since I have to login to each server to get the /etc/passwd file. Is there another way to get the local user information? They are now asking about seeing the last logon date or if the account is disabled, any thoughts there as well?

Most of our auditors think Windows and I am trying to make my life easier but not sure what options I have. I need to get local accounts and if they are active or disabled plus last logon date. I'm sure there will be more but if I can get the basics adding more shouldn't be too difficult but I guess I'll cross that bride when I get there. Oh yeah, any way to just pick out the local users and not the service daemons would also be helpful.

Any and all feedback welcomed. I am at a loss!
/etc/passwd is word-readable, so you can use scp originated on your central box "as you" to get it from other Linux boxes. Am I missed something ?
 
Old 08-18-2010, 07:43 AM   #3
bkone
Member
 
Registered: Jun 2006
Distribution: SUSE, Red Hat, Oracle Linux, CentOS
Posts: 108

Original Poster
Rep: Reputation: 15
I understand the /etc/passwd file is readable but I am looking for an automated way, script or something, that would allow me to pull this file down to my local machine. I am trying to prevent having to login to each and every machine in order to get this file or the lastlog file, I really would like to get the output of lastlog since it has the last time the user logged in.

Does that help?
 
Old 08-18-2010, 08:06 AM   #4
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by bkone View Post
I understand the /etc/passwd file is readable but I am looking for an automated way, script or something, that would allow me to pull this file down to my local machine. I am trying to prevent having to login to each and every machine in order to get this file or the lastlog file, I really would like to get the output of lastlog since it has the last time the user logged in.

Does that help?
So what wrong with using scp ?
 
Old 08-18-2010, 09:19 AM   #5
bkone
Member
 
Registered: Jun 2006
Distribution: SUSE, Red Hat, Oracle Linux, CentOS
Posts: 108

Original Poster
Rep: Reputation: 15
Nothing is wrong with scp but would I be able to have scp read a text file that contains a list of all my servers and pull down the /etc/passwd file to my local machine? I just don't want to login to each individual server in order to get this file or the lastlog file. I think this is going to be a reoccurring task so I am trying to simplify my life with a simple process to get this information. Would scp work, if so, do you have any recommendations on how I can accomplish what I am trying to do?
 
Old 08-18-2010, 09:43 AM   #6
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by bkone View Post
Nothing is wrong with scp but would I be able to have scp read a text file that contains a list of all my servers and pull down the /etc/passwd file to my local machine? I just don't want to login to each individual server in order to get this file or the lastlog file. I think this is going to be a reoccurring task so I am trying to simplify my life with a simple process to get this information. Would scp work, if so, do you have any recommendations on how I can accomplish what I am trying to do?
You can do something like that
Code:
#!/bin/sh
while read SERVER; do
    scp $SERVER:/etc/passwd passwd.$SERVER
done < SERVER_LIST
SERVER_LIST should contain list of your servers.
 
Old 08-19-2010, 06:57 AM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
... and set it to use ssh auth-keys instead of passwd to login ...
 
Old 08-19-2010, 07:08 AM   #8
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by chrism01 View Post
... and set it to use ssh auth-keys instead of passwd to login ...
Of course
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Merging Linux local accounts with LDAP accounts Nortekman Linux - Server 1 05-03-2009 11:20 PM
Fetchmail with multiple mail accounts and local accounts lmcilwain Linux - Software 3 04-01-2007 02:58 PM
Is there a command to obtain uname info remotely sohos Linux - Newbie 2 01-12-2006 08:58 AM
connecting to a local X session remotely? SocialEngineer Linux - Networking 6 12-23-2004 01:27 AM
Want to work remotely but see the desktop etc as local? northfield Linux - General 3 08-23-2002 07:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration