- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Moving passwd file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2002 11:08 AM
09-23-2002 11:08 AM
I have a requirement to move the passwd file from one server to another only taking those user-id's accessed within the last 90 days. Can anybody point me in the right direction without getting overwhelmed?
Thanks,
Mike Kapsak
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2002 11:14 AM
09-23-2002 11:14 AM
Re: Moving passwd file
Then write a script using the command lastb to find out which users logged in during the past 90 days , remove entries for all other users in the passwd.old file , then copy this file onto your new server as /etc/passwd .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2002 11:15 AM
09-23-2002 11:15 AM
Re: Moving passwd file
Try this way.
1. Run last -R > /tmp/success
2. "vi /tmp/success" and delete the entries that are more than 90 days old. Determine the
90 days old date (say Jun 23), search for it by using " :.,$d " in the vi session and save
the file.
3. Do "awk '{print $1}' /tmp/success |sort |uniq > /tmp/logins". Delete wtmp, root and other system logins from the list.
4. Now get the entries using
for i in `cat /tmp/logins`
do
grep ^$i /etc/passwd >> /tmp/passwd.delta
done
5. passwd.delta contains only user logins. Copy this to the other system and "append" it to the /etc/passwd file.
Things will be little bit complicated if you are using trusted systems.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2002 11:16 AM
09-23-2002 11:16 AM
SolutionTry this way.
1. Run last -R > /tmp/success
2. "vi /tmp/success" and delete the entries that are more than 90 days old. Determine the
90 days old date (say Jun 23), search for it by using " :.,$d " in the vi session and save
the file.
3. Do "awk '{print $1}' /tmp/success |sort |uniq > /tmp/logins". Delete wtmp, root and other system logins from the list.
4. Now get the entries using
for i in `cat /tmp/logins`
do
grep ^$i /etc/passwd >> /tmp/passwd.delta
done
5. passwd.delta contains only user logins. Copy this to the other system and "append" it to the /etc/passwd file.
Things will be little bit complicated if you are using trusted systems.
-Sri
PS: By the way, I do not know the scope of "overwhelming". We only try to help each other here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2002 11:20 AM
09-23-2002 11:20 AM
Re: Moving passwd file
If you want to see which users have had $HOME directory contents that have been changed in the last 90 days, assuming that they are all in /home:
find /home/* -mtime -90 -prune -print | cut -d"/" -f1 | sort -u
That might miss a few folks who didn't change any files. So you could try:
for i in `cut -f1 -d":" /etc/passwd`
do
last $i | head -1
done
You'd have to add something, probably using caljd.sh, to figure out the date. Or just redirect into a file and edit the list by hand.
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2002 12:06 PM
09-23-2002 12:06 PM
Re: Moving passwd file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2002 07:08 PM
09-24-2002 07:08 PM
Re: Moving passwd file
Alternatively, you might want to set up one new user on the second system, to be used as a skeleton for the rest. Copy the contents of the skeleton user's virginal $HOME to each of the imported user's home directories.
Regards
Jim