Wednesday, October 13, 2010

OSX Accounts(Add user/s & group)


Introductions:
Recently , my task is to migrate eprints in MAC Xserve and it was running in OSX platform.I thought there would be no painstaking hardwork that I woud be experiencing-I was wrong.Though OSX is inheritance of UNIX , there were additional functions for MAC which UNIX had not or nevertheless unsupported.Some were : the CLI command , installer , and additional file folder exclusively for MAC ony.Yet, everything seemed ported well, except a more funnier thing was the adding of user and group account for eprints.And you know why? It wasn't just as easy as "useradd" or "groupadd" but a more little deeper config just to have a new user /group accont in OSX- I am telling you.
Adding a user is something easily accomplished using the built in GUI tools that ship with OS X, however any power user can appreciate the possible efficiency gained from using the command line. So in the spirit of efficiency here are the steps necessary to add a user to your Mac OS X system all with our good friend, Terminal.app.These commands need to be run as either the root user or with the “sudo” command. For more information on the sudo command see the sudo man page.


Objectives:
1) To have a procedure in adding accounts in OSX-MAX CLI
2) To have a procedure in adding accounts in OSX-GUI menu.

Requirements:
Any computer with running OSX operating sytem ofcourse -Apple bro...
And please visit this site http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/dscl.1.html

Methodology:
Copy and Modiy the MAC main tutorial

CLI Mode (shell command)
Create a new entry in the local (/) domain under the category /users.
dscl / -create /Users/eprints

Create and set the shell property to bash.
dscl / -create /Users/eprints UserShell /bin/bash

Create and set the user’s full name.
dscl / -create /Users/eprints RealName "UP Digital Repository"

Create and set the user’s ID.
dscl / -create /Users/eprints UniqueID 503

Create and set the user’s group ID property.
dscl / -create /Users/eprints PrimaryGroupID 1000

Create and set the user home directory.
dscl / -create /Users/eprints NFSHomeDirectory /Local/Users/eprints

Set the password.
dscl / -passwd /Users/eprints eprints1234
or
passwd eprints

If you would like UP Digital Repository to be able to perform administrative functions:
dscl / -append /Groups/admin GroupMembership eprints

Another CLI Mode
Create the group

Find out the next gid. If there’s not one higher than 501 use 501, otherwise add one to the greatest number in this list: nidump group . This will also do it and just return the highest currently used number nidump group . cut -d: -f3 sort -n tail -n 1

sudo nicl . -create /groups/mygroup

sudo nicl . -create /groups/mygroup grouppassword \*

sudo nicl . -create /groups/mygroup gid 508
Append users

sudo nicl . -append /groups/mygroup users rod

sudo nicl . -append /groups/mygroup users jane

sudo nicl . -append /groups/mygroup users freddy

repeat to fade
Change owner of a folder and all sub folders, files

sudo chown -vR :mygroup ~/myfolder

sudo chmod -R 775 ~/myfolder

Logout and back in again to get your credentials with the new group in it up-to-date.
Job done.

In GUI Mode (gui command)
You can create individual user accounts for each person who uses your computer. Each new user has a separate home folder and can adjust his or her own preferences without affecting other users.

Choose Apple menu > System Preferences and click Accounts.

If some settings are dimmed, click the lock icon and type an administrator name and password.
Click Add (+) and type the user's name.

If you don't want to use the short name generated automatically, type a new short name. (Once the account is created, you won't be able to change the short name.)

Type the user's password in the Password and Verify boxes.

Type a hint to help the user remember the password if they have trouble remembering it at login.

Click Parental Controls and select options to determine what the user can do with the computer.

If you change your mind while you're creating a new user account, click Delete (-) to cancel.

Summary:
It is quite cool simple thing but if left unresolved will be an enchant disaster.

Conclusion:
It is done

No comments:

Post a Comment