![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| mirroring in lan between 2 pc | hossein | SCO | 3 | 03-31-2008 04:13 PM |
| mirroring ssa to san | itik | AIX | 1 | 03-25-2008 12:55 PM |
| Mirroring | DIMITRIOSDOUMOS | SCO | 0 | 08-12-2006 07:16 AM |
| Mirroring | dewsdwarfs | SUN Solaris | 2 | 06-27-2006 04:50 PM |
| Mirroring drives on Red Hat | BG_JrAdmin | UNIX for Dummies Questions & Answers | 1 | 02-06-2006 10:23 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
I'm looking for a way to mirror one user to another.
For example: If I have the user ABC and I want to mirror his: -Primary group -Any other groups ABC belongs to -UID -Home directory And create an exact copy over to another server to a user called XYZ. I already have SSH keys set up, don't worry about that, and I have the bulk of the code already .. but.. I'm having trouble writing the bit where it's like: If - the user already exists, just use usermod to change XYZ attributes with all of ABC's info. else - the user doesn't exist, use useradd to create the account XYZ with all of ABC's info. Here is the bit of code for the usermod: ssh -q $id@$servera "sudo usermod -d /home/${user1} -g $primgroup -G $grouplist -u $zaquid $user1" ssh -q $id@$servera "echo "${user}:examplepass" | sudo chpasswd" How do I write a statement that will execute that whole block of code, or different block of code. Should I put usermod command and the useradd command as a function and just do something like if x then usermod else useradd But how do I determine if the user already has an account? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|