Usermod returning syntax error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Usermod returning syntax error
# 1  
Old 07-02-2007
Tools Usermod returning syntax error

"sudo usermod -d /home/${user1} -g $primgroup -Gn $grouplist -u $zaquid -p apple1 $user1"

What's wrong with this command?
# 2  
Old 07-02-2007
Add a debug trace before the command and show us the output:

Code:
set -x
sudo usermod -d /home/${user1} -g $primgroup -Gn $grouplist -u $zaquid -p apple1 $user1
set +x

The option -Gn of the usermod command required a comma delimited list.
If you got the group list with the id command, this delimiter for that list is space.
Try to modifiy the id command :

Code:
id -GN user | sed 's/ \{1,\}/,/g'

# 3  
Old 07-02-2007
Quote:
Originally Posted by aigles
Add a debug trace before the command and show us the output:

Code:
set -x
sudo usermod -d /home/${user1} -g $primgroup -Gn $grouplist -u $zaquid -p apple1 $user1
set +x

The option -Gn of the usermod command required a comma delimited list.
If you got the group list with the id command, this delimiter for that list is space.
Try to modifiy the id command :

Code:
id -GN user | sed 's/ \{1,\}/,/g'


Here it is debugged:

+ ssh -q acce@comer sudo usermod -d /home/syncid -g staff -Gn staff -u 1231 -p xxx syncid
Usage: usermod [ -u uid ] [ -g group ] [ -G group1,group2 ... ] [-d dir [ -m ] ] [ -s shell ] [ -c comment ] [ -l new_name ] [ -e expire ] [ -r role1,role2 ... ] login

There is only one group under -Gn so I can't see that being the case.
# 4  
Old 07-02-2007
Replace the option -Gn by -G
# 5  
Old 07-02-2007
Quote:
Originally Posted by aigles
Replace the option -Gn by -G
Still syntax error. Here is the debugged:

+ ssh -q x@x sudo usermod -d /home/syncid -g staff -G staff -u 1231 -p xxx syncid
Usage: usermod [ -u uid ] [ -g group ] [ -G group1,group2 ... ] [-d dir [ -m ] ] [ -s shell ] [ -c comment ] [ -l new_name ] [ -e expire ] [ -r role1,role2 ... ] login

Is it because the -g and the -G are the same?
# 6  
Old 07-02-2007
The linux man page for the usermod commands doesn't signal restrictions.
Try to remove options one by one, to determine if one of them is source of the problem.
# 7  
Old 07-02-2007
Quote:
Originally Posted by syndex
Still syntax error. Here is the debugged:

+ ssh -q x@x sudo usermod -d /home/syncid -g staff -G staff -u 1231 -p xxx syncid
Usage: usermod [ -u uid ] [ -g group ] [ -G group1,group2 ... ] [-d dir [ -m ] ] [ -s shell ] [ -c comment ] [ -l new_name ] [ -e expire ] [ -r role1,role2 ... ] login

Is it because the -g and the -G are the same?
I don't see a -p option there.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Statement returning error only launching the sh script via crontab

hi all, I created a sh script to import some tables from mysql to hive. No problem launching it manually, but if I schedule via crontab it returns me an error in the following part: #create an array containing all the tables for $dbname query="SELECT table_name FROM information_schema.tables'... (10 Replies)
Discussion started by: mfran2002
10 Replies

2. Solaris

Usermod cannot working

i install Solaris 11.2 , Oracle Corporation SunOS 5.11 11.2 April 2015 and make 2 zones for Oracle RAC non-global zones : rac1, rac2 in zones i create group's and user's /usr/sbin/groupadd -g 1000 oinstall /usr/sbin/groupadd -g 1020 asmadmin /usr/sbin/groupadd -g 1021... (2 Replies)
Discussion started by: penchev
2 Replies

3. Shell Programming and Scripting

[Solved] FOR loop / IF statement returning error

The code at the bottom is a simplified example of what we have. If I use the following: && echo "echo failed" $? returns 1 When I use if ; then echo "echo failed" ; fi $? returns 0 Does anyone know what's wrong with this? Using AIX 6.1 and KSH for NUM in 1 2 3 do ... (5 Replies)
Discussion started by: jfxdavies
5 Replies

4. Programming

The fwrite function is not returning error, if the file was removed.

The fwrite function call is not returning error, when the file it writes to is removed, please advise on how to find if the file already opened and being written by a program is removed manually or by some other process. please see the code below, #include<stdio.h> #include<stdlib.h> ... (3 Replies)
Discussion started by: Kesavan
3 Replies

5. Shell Programming and Scripting

Script returning an error message on exiting

Hi, I am writing a script in which I am using an IF-Else statement. Code sample: # Check for the product. If (test "$3" = "Pet") Then Product_Code="PI" elif (test "$3" = "Breakdown") Then Product_Code="RI" elif (test "$3" = "Travel") Then Product_Code="TI" ... (2 Replies)
Discussion started by: bghosh
2 Replies

6. Shell Programming and Scripting

shell script returning error code 2 from AIX to Mainframe

Hi, I have a shell script which is residing on AIX which is triggered by Mainframe through Connect Direct. The shell script creates several files and sends those files to mainframe using Connect Direct. The shell script is working fine, still it is returning exit code 2 to mainframe. What... (0 Replies)
Discussion started by: Yogesh Aggarwal
0 Replies

7. AIX

usermod in AIX

Hello All, Could you please let me know if the usermod command works in AIX? If yes, on what versions? We have a situation in which we need to change the UID of few users who have the same UID as root. We have changed it in /etc/passwd for now but want to use usermod in future. The syntax is as... (2 Replies)
Discussion started by: lovesaikrishna
2 Replies

8. UNIX for Dummies Questions & Answers

Loop on array variable returning error: 0 not found

I'm guessing i have a syntax error. I'm not sure it get's past the the while condition. I get an error 0 not found. Simple loop not sure what I'm doing wrong. #!/usr/bin/ksh set -A MtPtArray /u03 /u06 tUbound=${#MtPtArray } echo $tUbound i=0 while ($i -lt $tUbound) do print... (4 Replies)
Discussion started by: KME
4 Replies

9. Solaris

usermod vs rolemod

Hello, I'm a bit confused by the usage of those two commands. I have 2 freshly installed systems and the behaviour is different from one system to another. root@systemONE rolemod -G mygroup postgres UX: rolemod: ERROR: Users most be modified with ``usermod''. root@systemTWO usermod -G... (6 Replies)
Discussion started by: Tex-Twil
6 Replies

10. UNIX for Dummies Questions & Answers

usermod -e

I'm trying to add an expiration to all of the local logins, but everytime I do the: usermod -e <date> <login> command, I get a error msg "usermod error <date> is not a valid expiration date. CHoose another" I've tried 6/26/06, June 26, 2006, 26/6/06, 6/26/2006 everything I can think of. ... (1 Reply)
Discussion started by: amheck
1 Replies
Login or Register to Ask a Question