• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: creating users from WebObject or Terminal
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: creating users from WebObject or Terminal


  • Subject: Re: creating users from WebObject or Terminal
  • From: Nathan Walker <email@hidden>
  • Date: Thu, 9 Sep 2004 18:05:02 -0400

webmaster,

YOU ARE GENIUS !! THANK YOU....but what would i do to call this from WebObjects ?? you know ??

like i mentioned ERXRuntimeUtilities I was told could do this but i need to use some variables that
are entered into a form in my WO app to use as the username and password in the script...??


and i'm having trouble locating ERXRuntimeUtilities in Project Wonder 2.0 ??
got any genius tips to do that ??


also, i have searched for what options i add to the niutil command to enable mail access on the localhost
for a user ?? This is something that is assigned in Workgroup Manager....


You rule, i would donate some money to you if you could help me with this....
That would be huge...


Thanks,
Nathan


On Sep 3, 2004, at 5:37 PM, webmaster wrote:

On Sep 03, 2004, at 15:29, Nathan Walker wrote:

I was looking for ERXRuntimeUtilities in the current 2.0 release of Wonder and I don't see it.
Anybody know where it is ?


I need to call some command-line calls from my WOapp to automatically add somebody to the
NetInfo Manager Database. by the way, anybody got a script to do this already ??
also, what is the command to enable mail access for a user (Like when I add a user in
Workgroup Manager on X Server and I enable Mail access for them and specify the server)...how would I do this
with the command line or how could I call it from WO ??


Thanks,

This will create a user named "natwalk" with a password of "walknat" and give him "staff" privileges, it shouldn't be too difficult to script this.


in terminal execute:
sudo niutil -create . /users/natwalk
sudo niutil -createprop . /users/natwalk uid 2048
sudo niutil -createprop . /users/natwalk gid 20
sudo niutil -createprop . /users/natwalk shell /bin/tcsh
sudo niutil -createprop . /users/natwalk home /Users/natwalk
sudo niutil -createprop . /users/natwalk passwd "walknat"

this is a possible script and has a -test option to see the information without actually creating the user, you can add any proprieties you require and you can call if from WO.

filename - myadduser
save in /usr/bin
chmod 0755
chown root

example execution: (need to run as root so we sudo)
sudo myadduser -d /Users/natwalk -i 2048 -g 20 -u natwalk -p walknat

#!/bin/sh
#
####################################################################### ##################
# Variables #
####################################################################### ##################


#define MYADDUSER_VERSION "0.1.0"

VER=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\)".*/\1/p' < $0`;


####################################################################### ##################
# Display Help #
####################################################################### ##################


while test $# -ge 1;
do
case "$1" in
-h | --help)
echo;
echo ' ===================================================================';
echo ' myadduser Ver '"${VER}";
echo ' ===================================================================';
echo;
echo 'usage:';
echo ' ------------------------------------------------------------------- ';
echo ' '"$0"' [options...]';
echo ' ------------------------------------------------------------------- ';
echo;
echo 'options:';
echo ' ------------------------------------------------------------------- ';
echo ' -d |--dir=PATH | absolute PATH where home is stored';
echo ' -h |--help | This help message';
echo ' -i |--id | user id.';
echo ' -g |--gid | group id.';
echo ' -p |--password=PASSWORD | PASSWORD used to access database';
echo ' -u |--user=USER | USER name used to access database';
echo ' -ver |--version | Displays version information.';
echo ' ------------------------------------------------------------------- ';
echo;
exit 0;;


-d* | --dir*) auhome="$2"; shift; shift;;
-i* | --nuuid*) auid="$2"; shift; shift;;
-g* | --nugid*) auid="$2"; shift; shift;;
-u* | --user*) auname="$2"; shift; shift;;
-p* | --password*) aupswd="$2"; shift; shift;;
-ver | --version) echo; echo 'myadduser Version '"${VER}"; echo; exit 1;;
-t | --test) echo; echo 'myadduser Version '"${VER}";
echo 'user Name = "'${auname}'"';
echo 'user ID = "'${auuid}'"';
echo 'user PASSWORD = "'${aupswd}'"';
echo 'user HOME = "'${auhome}'"';
echo 'user GROUP = "'${augid}'"';
echo; exit 1;;


		*) echo "unknown option: $1"; echo "$0 --help for help"; exit 1;;
    esac;
done;

echo ;

####################################################################### ##################
# Start of Program Proper #
####################################################################### ##################
`niutil -create . /users/$auname`;
`niutil -createprop . /users/$auname uid $auuid`;
`niutil -createprop . /users/$auname gid $augid`;
`niutil -createprop . /users/$auname shell /bin/tcsh`;
`niutil -createprop . /users/$auname home $auhome`;
`niutil -createprop . /users/$auname passwd $aupswd`;
exit;
_______________________________________________
macos-x-server mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macos-x-server
Do not post admin requests to the list. They will be ignored.
When responding to messages, please keep your quotes short.



-------------------
Nathan Walker
229-460-2677
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >(no subject) (From: Nathan Walker <email@hidden>)

  • Prev by Date: Re: _exceptionWithDatabaseContextInformationAdded when trying to update SQL Server
  • Next by Date: Re: Re(2): Command line from Java (through AppleScript)
  • Previous by thread: Re: Re(2): Command line from Java (through AppleScript)
  • Next by thread: (no subject)
  • Index(es):
    • Date
    • Thread