Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 08-13-2002, 10:13 AM   #1
LQ Newbie
Registered: Jul 2002
Posts: 15

Rep: Reputation: 0
Question useradd command

Is there a way to execute another command after I execute the useradd command. I know that you can copy files from /etc/skel into the users home directory when you run useradd but can I make Redhat 7.2 execute another command as soon as it is done running the useradd command?


Old 08-13-2002, 10:17 AM   #2
LQ Addict
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
try &&
useradd options username && other_command
if useradd completes without erroring out other_command executes, if the return status from useradd is other than 0 other_command never gets executed.
is this what you need?
Old 08-13-2002, 10:22 AM   #3
LQ Newbie
Registered: Jul 2002
Posts: 15

Original Poster
Rep: Reputation: 0
Is there a way to hide that so my reps can add users without having to type all of that in? I'm not thinking that I can but I thought that I would ask.
Old 08-13-2002, 10:55 AM   #4
Registered: Jul 2002
Location: India
Distribution: Ubuntu, Gentoo
Posts: 99

Rep: Reputation: 15
If u r creating users with the useradd command ,
u dont have to maully copy the file from /etc/skel
to the user's home dir .
Old 08-13-2002, 06:24 PM   #5
LQ Guru
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
I don't know about other distros, but in my version of Slack (8.1) the adduser command is a "walk through" to add users, if that is what you are trying to accomplish. To someone who doesn't know what they are doing, adduser may be a little easier to use than useradd.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
useradd command Wolvastur Linux - Newbie 9 01-25-2005 11:01 AM
useradd command question hct224 Linux - Newbie 2 06-14-2004 05:47 PM
Useradd command not found. keysorsoze Red Hat 8 05-01-2004 04:17 PM
useradd command johnpayback Linux - Newbie 5 08-13-2002 11:22 AM
useradd command allancondino Linux - General 5 04-27-2002 01:01 PM

All times are GMT -5. The time now is 03:30 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration