Need to sort/change modify 2300 users ...


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Need to sort/change modify 2300 users ...
# 1  
Old 08-06-2008
Need to sort/change modify 2300 users ...

Ok, so here's my project I've been given and I know very little about this.

I have an AIX unix box that has over 2300 local users.

Any user with 4 or less characters in the username does not get changed.

Any user with 5 or more needs to have the attribute shell=/bin/ksh changed to shell=/bin/true

I have a vague idea how to do this, but everyone on these forums seems pretty helpful and nice, so I thought i'd give it a shot and see what you guys would recommend doing.

Thanks a ton guys!
# 2  
Old 08-06-2008
Something like this perhaps?

Code:
awk -F: -v OFS=: 'length($1)>4 { $7="/bin/true" } 1' /etc/passwd > /tmp/newpasswd

Note that you may affect some system accounts doing this though, such as "nobody", "nuucp", "daemon", so you'll probably want to make it a bit more selective. I'll leave that part as an exercise for you!

Last edited by Annihilannic; 08-06-2008 at 03:15 AM.. Reason: I always forget to set OFS!!!!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to Modify a file content in UNIX and sort for only required fields ?

I have the below contents in a file after making the below curl call curl ... | grep -E "state|Rno" | paste -sd',\n' | grep "Disconnected" > test "state" : "Disconnected",, "Rno" : "5554f1d2" "state" : "Disconnected",, "Rno" : "10587563" "state" : "Disconnected",, "Rno" :... (2 Replies)
Discussion started by: Vaibhav H
2 Replies

2. Solaris

Can't change users passwd

Have an issue with a user or root changing the user's passwd. We run the passwd command and a complex passwd is entered a message is displayed, "passwd is based on a dictionary word." We do have a dictionary file and I know for a fact the complex passwd is not in the list. This happens on a... (3 Replies)
Discussion started by: solizkewl
3 Replies

3. Solaris

To restrict the users not to change the passwords for NIS users

Hi All, How to restrict the NIS users not to change their passwords in for NIS users?? and my NIS user is unable to login to at client location what could be the problem for this ? Any body can help me. Thanks in advance. (1 Reply)
Discussion started by: Sharath Kumar
1 Replies

4. Shell Programming and Scripting

Change of group to different users

Need to change the chgrp for different uses d---rwx--t 3 root 764 4096 Mar 16 2007 algavi d---rwx--t 6 root 2857 4096 Jul 16 11:28 alharki d---rwx--t 5 root 2739 4096 Oct 14 2008 alpen d---rwx--t 5 root 546 4096 Mar 16 2007 alvarez d---rwx--t 3 root... (2 Replies)
Discussion started by: gsiva
2 Replies

5. Shell Programming and Scripting

sort change

Hi i have a code where there is a sort command. but i am not able to understand what it does. (checked the man page but it is too confusing) cut -c 1-5,19-32,45-57 input.dtl| sort -c -T /temp/sorts -y +0.19 -0.32 +0.5 -0.19 +0.0 -0.5 can some one pls help (1 Reply)
Discussion started by: dnat
1 Replies

6. HP-UX

How to enforce users not to modify their command history.

As a system administrator. sometimes we see the users are trying some commands dangerous for the system health and remove them from their individual coomand history file. How it is possible to enforce that the normal usres will will not be able to modify the history. Thanks in advance. Partha (4 Replies)
Discussion started by: partha_bhunia
4 Replies

7. Shell Programming and Scripting

Modify users password via script?

Ok, first off, I'm working on a Vmware ESX server, which I guess is loosely based off of Red Hat 9. But I'm brand new to it (today), so be nice. I'm trying to write a useradd script that will create some users, generate a password, and set their password to this newly generated password. ... (2 Replies)
Discussion started by: paqman
2 Replies

8. Solaris

Qlogic 2300 and WWN display

hi all, I'm looking for a command to display the WWN of my 2 HBAs cards installed on my Solaris 8 server. I have installed HP securepath for multipathing but I can only see the controllers info of my SAN with spmgr display command. Any ideas ? Thanks a lot. Fabien (10 Replies)
Discussion started by: unclefab
10 Replies

9. AIX

Change users login name

Hi, I need to change some users login name in AIX. With solaris i donīt had problems, i have used "usermod". But in AIX the usermod command donīt have the same behavior. Can someone give me a tip on how to perform these changes? Thanks in advance. (9 Replies)
Discussion started by: spacewalker
9 Replies

10. Shell Programming and Scripting

How do I change users in a script???

Hi there, Does anyone know of a way I can become a different user in a script? I need to run a script as one user (not root), and change to another user half way through. It stops and asks me for the password, and I can't find a way to feed the password in through the script. Thanks (2 Replies)
Discussion started by: chorgan
2 Replies
Login or Register to Ask a Question