Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › Adding users in terminal with useradd, can these options be combined into one command?
New Posts  All Forums:Forum Nav:

Adding users in terminal with useradd, can these options be combined into one command?

post #1 of 7
Thread Starter 
I'm using a Fedora installation and just learning about adding new user accounts to a system. If I've got a list of settings I'd like to set when I make the account, would I just tack all these on to the useradd command or would I use the useradd command with just one parameter attached then use usermod to change the rest of the settings?

More specifically, I'm referring to adding a GECOS, setting the password, and setting a specific home directory. It appears as if useradd and usermod share options, but I'm just looking to see if it can be combined into one big command rather than seperate ones.

Any help would be appreciated.
post #2 of 7
You can always "combine" commands with the &&:


cat /proc/version && cat /proc/asound/version
Current Rig
(14 items)
 
  
CPUMotherboardGraphicsRAM
FX-8350 4.6GHz@1.44v GA-990FXA-UD3 R4.0 HD 7950 (1100/1450) 8G Muskin DDR3 1866@8CLS 
Hard DriveOptical DriveOSMonitor
1TB WD LiteOn DVD-RW DL Linux/Windows 19" Phillips TV 1080p 
PowerCaseMouseMouse Pad
OCZ 600W Generic Junk Logitech MX400 Generic Junk 
Audio
SBL 5.1 
  hide details  
Reply
Current Rig
(14 items)
 
  
CPUMotherboardGraphicsRAM
FX-8350 4.6GHz@1.44v GA-990FXA-UD3 R4.0 HD 7950 (1100/1450) 8G Muskin DDR3 1866@8CLS 
Hard DriveOptical DriveOSMonitor
1TB WD LiteOn DVD-RW DL Linux/Windows 19" Phillips TV 1080p 
PowerCaseMouseMouse Pad
OCZ 600W Generic Junk Logitech MX400 Generic Junk 
Audio
SBL 5.1 
  hide details  
Reply
post #3 of 7
Thread Starter 
Quote:
Originally Posted by mushroomboy View Post

You can always "combine" commands with the &&:
cat /proc/version && cat /proc/asound/version

Would I do something like useradd example1 && usermod -u 734 example1 to first make a user named example1 then change their UID to 734?
post #4 of 7
Yeah, the && command just states that you are doing another command. I did two commands but parsed it to bash as one, bash then split it up because it saw the && together. You can also use & but I'm unfamiliar with exactly how & and && differ.
Current Rig
(14 items)
 
  
CPUMotherboardGraphicsRAM
FX-8350 4.6GHz@1.44v GA-990FXA-UD3 R4.0 HD 7950 (1100/1450) 8G Muskin DDR3 1866@8CLS 
Hard DriveOptical DriveOSMonitor
1TB WD LiteOn DVD-RW DL Linux/Windows 19" Phillips TV 1080p 
PowerCaseMouseMouse Pad
OCZ 600W Generic Junk Logitech MX400 Generic Junk 
Audio
SBL 5.1 
  hide details  
Reply
Current Rig
(14 items)
 
  
CPUMotherboardGraphicsRAM
FX-8350 4.6GHz@1.44v GA-990FXA-UD3 R4.0 HD 7950 (1100/1450) 8G Muskin DDR3 1866@8CLS 
Hard DriveOptical DriveOSMonitor
1TB WD LiteOn DVD-RW DL Linux/Windows 19" Phillips TV 1080p 
PowerCaseMouseMouse Pad
OCZ 600W Generic Junk Logitech MX400 Generic Junk 
Audio
SBL 5.1 
  hide details  
Reply
post #5 of 7
useradd supports all the same options that usermod does, so you're really better off just running it all in useradd
post #6 of 7
Thread Starter 
Thanks guys thumb.gif
post #7 of 7
Quote:
Originally Posted by Methos07 View Post

Thanks guys thumb.gif

What did you do in the end?
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Linux, Unix
Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › Adding users in terminal with useradd, can these options be combined into one command?