Script Entry to block 9 characters userid


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script Entry to block 9 characters userid
# 8  
Old 10-17-2013
Note that there's a typo in my original suggestion.
# 9  
Old 10-17-2013
You mean the sql die?
Yeah, might be better to use:
Code:
[ ! ${#username} -le 8 ] && echo "$username's ID is too long" && exit 1

This User Gave Thanks to sea For This Post:
# 10  
Old 10-17-2013
No - the test was missing a mandatory space.

die is already used in line 2 of the OP's script, so I assumed it was either available as a local function/command, or he has other problems Smilie.
# 11  
Old 10-17-2013
Quote:
Originally Posted by sea
You mean the sql die?
Yeah, might be better to use:
Code:
[ ! ${#username} -le 8 ] && echo "$username's ID is too long" && exit 1

Superdb!!! This worked! Thanks a lot !!


Code:
-bash-3.2$ /usr/local/bin/sudo /opt/local/bin/new-user 199  testuser1 "test user (Script testing User)" INC00017310
testuser1's ID is too long;should not more than 8 characters
-bash-3.2$

---------- Post updated at 11:11 PM ---------- Previous update was at 11:01 PM ----------

I have one more query, which I need to understand,
we have one condition for RFUsers means userid starting with "rf" should have password se to NO EXPIRY after first password change.

So whenever RF user say for ex. "rfuser45" logins to system with default password and then sets its new own password that userid password is set to NO EXPIRY.


The script is also working fine in that way.


but this is waht we actually use in Solaris os to get it done

passwd -x -1 rfuser45

but I don't understand why in script something like this is written:-


Code:
 # rf accounts do not expire password after first change
        if [[ $username = rf* ]]; then
                passwd -x 0 "$username"
        fi

        warn    "Step 3 completed"

fi

set +x

what does this mean?

Code:
passwd -x 0 "$username"

Thanks.
# 12  
Old 10-17-2013
man says:
Code:
-x, --maxdays MAX_DAYS
           Set the maximum number of days a password remains valid. After
           MAX_DAYS, the password is required to be changed.

This User Gave Thanks to greet_sed For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Cron entry to pass the value to script

0 I have a script(main.sh) which calls another script(Get_Files.sh) and gets a value in a variable like the below: File_to_Refresh="$(sh /Aug/work/Get_Files.sh /Aug/Work/Universal_File.txt)" Now I have to schedule the script main.sh for 3 different files i.e. the Universal_File.txt with 3... (2 Replies)
Discussion started by: bhartiya007
2 Replies

2. Shell Programming and Scripting

How to replace multiple "&nbsp;" entry with in <td> tag into single entry using sed?

I have the input file like this. Input file: 12.txt 1) There are one or more than one <tr> tags in same line. 2) Some tr tags may have one <td> or more tna one <td> tags within it. 3) Few <td> tags having "<td> &nbsp; </td>". Few having more than one "&nbsp;" entry in it. <tr> some td... (4 Replies)
Discussion started by: thomasraj87
4 Replies

3. Shell Programming and Scripting

awk script to call another script based on second column entry

Hi I have a text file (Input.txt) with two column entries separated by tab as given below: aaa str1 bbb str2 cccccc str3 dddd str4 eee str3 ssss str2 sdf str3 hhh str1 fff str2 ccc str3 ..... ..... ..... (1 Reply)
Discussion started by: my_Perl
1 Replies

4. How to Post in the The UNIX and Linux Forums

Help me, write a bash script to delete parent entry with all their child entry in LDAP UNIX server

Hi All, Please help me and guide me to write a bash/shell script on Linux box to delete parent entry with all their child entries. example: Parent is : ---------- dn: email=yogesh.kumar@wipro.com, o=wipro, o=in child is: ---------- dn: cn: yogesh kumar, email=yogesh.kumar@wipro.com,... (1 Reply)
Discussion started by: Chand
1 Replies

5. Shell Programming and Scripting

Automatic su password entry script

Before I start, two things. 1) Yes I know it's bad practice and obomination to all things holy, but I'm not a sys admin at JP Morgan, I'm a hobbyist tooling about in a VM, in my pants, at home. 2) If you are just going to flame for even considering hardcoding a root password, thanks, I get... (2 Replies)
Discussion started by: 3therk1ll
2 Replies

6. Shell Programming and Scripting

mapping userid to an email in script

i have about 20 different users submitting a web form that executes a unix script in the background that sets EXECUTIONUSER to their unix id. i would like to use $EXECUTIONUSER to set their email address as EMAILADDR. of course their unix id does not match their email name either. for example: ... (3 Replies)
Discussion started by: crimso
3 Replies

7. Shell Programming and Scripting

FTP automation with special characters in userid

Hi, i am trying to automate an ftp script which is as below.But my user id has special characters(aaa\$ifg). So it is not working correctly.Can anyone help on this?I tried providing both of them in double & singe quoted. But somehow it is not picking the "\". Also tried keeping \ before the... (3 Replies)
Discussion started by: aeroticman
3 Replies

8. Solaris

How do I configure sendmail to block all OUTGOING mail FROM one userid TO the world?

Hello, ENVIRONMENT: OS: Solaris 10 Sendmail: 8.13.8+Sun BACKGROUND: We had a user account that was compromised and was used as a relay. She sent out (or would have if we didn't kill sendmail) ~10K emails alerting people they just won $75K. The target for this spam was everyone internal... (1 Reply)
Discussion started by: avikb
1 Replies

9. Shell Programming and Scripting

Script to find systems logged in with a particular userid

Hello All, I need to design a script to get all the systems names(IP Addresses) logged in with a particular userid say 'xyz' from different terminals. This is to track the use of the particular userid and take action if it is being misused. The script would accomplish the following steps: 1.... (1 Reply)
Discussion started by: mehimadri
1 Replies

10. Shell Programming and Scripting

Script for data entry

Hello everyone. I just registered like 17 minutes ago and am new to UNIX/Linux. I work in a small department of an animation company that does compositing tricks to fix movie frames. After our work is completed we are tasked with creating a text log that has information on what work we had... (7 Replies)
Discussion started by: AndrewP
7 Replies
Login or Register to Ask a Question