FreeBSD - Tutorials, Security
Home   Archives   Sitemap   About   Contact

FreeBSD add user command

Home NEW! Unix Forum News 100 Tips and Tricks Website Development Server Operating Systems Databases
 Ivorde.ROarrow Server Operating Systems arrowAdministration GuidesarrowFreeBSD add user command 

Article Sections

    Hello, Guest !
User name:
Password:
 
Google

 SATELLITE INTERNET
 FreeBSD Tutorials
 Linux LVM Commands
 Free Shell Accounts
 FreeBSD Project
 FreeBSD Handbook
 Advanced Bash-Scripting Guide
 The OpenBSD Project
 Distrowatch
 FreeBSD Handbook


Apache Webserver Home Page

Blog, intrebari si raspunsuri despre Leasing

Posted on: 28 Mar 2008
Author: mandrei
Section: Server Operating Systems | Administration Guides
Views: 623
Comments: 4 (Add)

FreeBSD add user command
freebsd, user, add user command, freebsd add user

FreeBSD add user command

Below FreeBSD command will add user name named newuser with expiration date on 1st of September 2008 (-e), with default shell bash (-s). The user's home directory (/home/newuser) will be automatically created (-m argument).

For my normal users I have created a special login class called restricted which has limited number of processes, open files and so on. This user will automatically have this login class set (-L).

Additionally, after executing this command I will have a prompt in which newuser's password will be asked.

$ pw useradd -n newuser -e 01-09-2008 -m -s /usr/local/bin/bash -h 0 -L restricted -c "New user on FreeBSD"

pw useradd's arguments:

The following options apply to the useradd and usermod commands:
-c comment    This field sets the contents of the passwd GECOS field,
                   which normally contains up to four comma-separated fields
                   containing the user's full name, office or location, and
                   work and home phone numbers.  These sub-fields are used by
                   convention only, however, and are optional.  If this field
                   is to contain spaces, you need to quote the comment itself
                   with double quotes `"'.  Avoid using commas in this field
                   as these are used as sub-field separators, and the colon
                   `:' character also cannot be used as this is the field sep-
                   arator for the passwd file itself.
-n name       Specify the user/account name.
-e date       Set the account's expiration date.  Format of the date is
                   either a UNIX time in decimal, or a date in `dd-mmm-yy[yy]'
                   format, where dd is the day, mmm is the month, either in
                   numeric or alphabetic format ('Jan', 'Feb', etc) and year
                   is either a two or four digit year.  This option also
                   accepts a relative date in the form `+n[mhdwoy]' where `n'
                   is a decimal, octal (leading 0) or hexadecimal (leading 0x)
                   digit followed by the number of Minutes, Hours, Days,
                   Weeks, Months or Years from the current date at which the
                   expiration date is to be set.
-m            This option instructs pw to attempt to create the user's
                   home directory.  While primarily useful when adding a new
                   account with useradd, this may also be of use when moving
                   an existing user's home directory elsewhere on the file
                   system.  The new home directory is populated with the con-
                   tents of the skeleton directory, which typically contains a
                   set of shell configuration files that the user may person-
                   alize to taste.  Files in this directory are usually named
                   dot.<config> where the dot prefix will be stripped.  When
                   -m is used on an account with usermod, existing configura-
                   tion files in the user's home directory are not overwritten
                   from the skeleton files.
-s shell      Set or changes the user's login shell to shell.  If the
                   path to the shell program is omitted, pw searches the
                   shellpath specified in /etc/pw.conf and fills it in as
                   appropriate.  Note that unless you have a specific reason
                   to do so, you should avoid specifying the path - this will
                   allow pw to validate that the program exists and is exe-
                   cutable.  Specifying a full path (or supplying a blank ""
                   shell) avoids this check and allows for such entries as
                   /nonexistent that should be set for accounts not intended
                   for interactive login.
-h fd         This option provides a special interface by which interac-
                   tive scripts can set an account password using pw.  Because
                   the command line and environment are fundamentally insecure
                   mechanisms by which programs can accept information, pw
                   will only allow setting of account and group passwords via
                   a file descriptor (usually a pipe between an interactive
                   script and the program).  sh, bash, ksh and perl all pos-
                   sess mechanisms by which this can be done.  Alternatively,
                   pw will prompt for the user's password if -h 0 is given,
                   nominating stdin as the file descriptor on which to read
                   the password.  Note that this password will be read only
                   once and is intended for use by a script rather than for
                   interactive use.  If you wish to have new password confir-
                   mation along the lines of passwd(1), this must be imple-
                   mented as part of an interactive script that calls pw.
-L class      This option sets the default login class for new users.


Now that the user was added to the system, we can show user's details.

Show user details on FreeBSD 

$ pw usershow newuser
newuser:*:4015:4016:restricted:0:1220223600:New user on FreeBSD:/home/newuser:/usr/local/bin/bash

 

Bookmarks: Echo "FreeBSD add user command" around:
del.icio.usdiggFurlYahooMyWebGoogleBookmarksFaceBookTechnocratti
-------------------advertising-----------------

Other articles in Server Operating Systems / Administration Guides
» Change user shell on FreeBSD Linux and AIX
» AIX 5.3 TL 6 and Apache 1.3 - httpd: bad user name nobody
» How to change a user's password in AIX with the output from ECHO command
» How to allow access to su to root on FreeBSD
» SU Error - su: not running setuid - FreeBSD - Linux




Contact webmaster regarding this article
Register or Login to post your article
Hello, Guest ! You can Login or Register to www.ivorde.ro!

 Post comment:

Name:
Title:
Comment:
Please type the word you see in the image (anti-spam verification). Refresh the page if you don't understand the word.
Verification code
Allowed HTML Tags for comments:<p><strong><em><u><h1><h2><h3><h4><h5><h6><img><li>
<ol><ul><span><div><br><ins><del>

4 comment(s) to FreeBSD add user command:

1. Re: FreeBSD add user command
nekptefp by nekptefp at December 29th, 2008 - 11:39
kdffpufq ytplpzyb http://wvmhjlqw.com hiwywpdt ctwgjzhn [URL=http://ahogqxaf.com]paalsxso[/URL]

2. Re: FreeBSD add user command
Very popular site, infant safe haven laws, %-), n by home fire safes valparaiso india at December 27th, 2008 - 09:55
Very popular site, infant safe haven laws, %-), nebraska safe harbor law, 196348, concealed wall safes, 318646, safe diets for teen girls, =DDD, safes gun, >:-[, start xp in safe mode, 0959, minimum safe home temperature, hehlzp, safe sex free condoms, 0734, prefabricated safe rooms meeting fema 361 specifications, jkec, floor safes used, jcq, sample radio script safe sex, %-((, awarding safe driving, 20644, how to have safe sex, %), whats the turning sequence to a liberty gun safe, :-[, safe to have sex after prostate radiation, 8[, fireproof waterproof safe, 8DD, safe time to have sex with menstrual cycle, 8)), a safe haven chicago, lhs, home jewelry safe, ism, used gun safes, >:-(, sentry 1610 safe, juf, ice safe pet melt, >:-OO, anthrax safe home, 768278, winchester gun safe, >:]], oral sex safe, 9156, minimum safe home temperature, 493, compare fireproof safes, 8414, dog saves kittens in fire, 661, honeywell fire and theft safe, 12911, hidden gun safes, %-PPP,

3. Re: FreeBSD add user command
Cool site, liberty key safe vegas, vddtm, dog sav by safe diets for teens at December 26th, 2008 - 17:26
Cool site, liberty key safe vegas, vddtm, dog saves babys life, 341, safe xxx porn sites, tzyta, powerpoints for safe lifting training, ibzr, dog saves dog freeway, :O, safe federal credit union, htkpat, is looking up porn safe, 75902, halls lock and safe floor safe, 75943, boot into safe mode, qeau, homak gun safes, %)), safe harbor investment covenants, zevp, mosler safe company, counter systems, 024185, how to boot windows in safe mode, kpqq, california gun safe, %DDD, sentry safe model a3860, preset factory code, 92258, pet safe screen doors, 879, how to bypass safe eyes on macintosh, %O, password safe, eal, safe sex web sites, :P, terrier dog saves litter of kittens, vnng, lowest price fireproof safes, 92697, keeping items in a home safe, 061264, powerpoints for safe lifting training, macwf, browning gun safe, 557363, mommy saves big, pcpyc, secure vault gun safes autos, >:DD, home wall safe, unlpat, freedom gun safes, whjg,

4. Re: FreeBSD add user command
My cool site, scotchgardt ultra water repellent wi by mosquito repellents at December 26th, 2008 - 00:23
My cool site, scotchgardt ultra water repellent with mildew block, 34526, best mosquito repellent, 8-[[[, spider repellent, fdhlgn, homemade squirrel repellent, wedgy, homemade snake repellent, spr, homemade mouse repellent, =], household squirrel repellent, %-[[, homemade deer repellent, 4678, urine as repellent, iftmiy, shark repellent, :PPP, natural cat repellent, 029302, natural spider repellent, 0122, water repellent window curtains, 105428, water repellent shade screen, 371240, natural flea repellent, =-OO, backyard insect repellent, nsfp, bat repellent, 28024, off insect repellent, 555244, recipe for squirrel repellent, 17097, make cat repellent, nvxwa, stain repellent spray, %-D, mosquito repellent review, 5942, insect repellent wipe, heu, insect repellent spray, =-[[, pest repellent, =(((, water repellent, 07439, coyote repellent, 6963, dog repellent, keoald,

   Latest topics on the forum:
Nginx + php-fpm setting php upload_max_filesize and other php values per vhost
Mysql> how to store select Zulu / UTC timestamp in database
Quagga ospf neighbour stuck in ExStart/DROther state
How to disable anonymous access in samba 3
"checking for libnet_build_ip in -lnet... no"+"ERROR! Libnet library not found"
CentOS Install Nemesis packet crafting tool + Libnet
Using curl to get the HTTP response from an HTTP server
Mdadm - Linux software RAID
Linux - Unable to login (and authentication succeeds) - File size limit exceeded
Linux/FreeBSD how to check ntp time synchronization
 
   Most viewed articles:
How to remove first/last character from a string using SED - 6787 views
How to clear/reset DNS cache on Windows XP / Linux - 4458 views
Reloading /etc/profile - how to reload Unix /etc/profile - 4419 views
How to calculate difference in days between two dates in MySQL - 4380 views
Set up HTTP PROXY via command line in Linux/FreeBSD - 3663 views

   Latest 10 articles:
FreeBSD - Collect installed hard disk drive information - 19 Mar 2009
Set up FTP PROXY via command line in Linux/FreeBSD - 19 Mar 2009
Set up HTTP PROXY via command line in Linux/FreeBSD - 19 Mar 2009
Qmail relay to smarthost: How to route all mail to a smarthost - 03 Feb 2009
EXIM 4 relay to smarthost: How to route all mail except local domain - 03 Feb 2009
Windows XP: print LISTEN ports and network connections using netstat - 30 Jan 2009
qmail qmail-scanner/clamav qmail-inject: fatal: qq temporary problem / clamdscan: corrupt or unknown clamd scanner error or memory/resource/perms problem - exit status 512/2 - 05 Dec 2008
How to cut out first last n characters from each file name, from a filelist - 04 Nov 2008
Mozilla Firefox3 is now released - 18 Jun 2008
How to switch lower case to upper case and upper case to lower case in a string - 17 Jun 2008


Archives
» 2007  |  June  |  October  |  November  |  December
» 2008  |  January  |  February  |  March  |  April  |  May  |  June  |  November  |  December
» 2009  |  January  |  February  |  March



Home | Archives | Sitemap | About | Contact

Designed and developed by Andrei Manescu. Optimized for Mozilla Firefox.  
Copyright 2007 Andrei Manescu
All trademarks and copyrights on this page are owned by their respective owners. Comments are owned by those who posted them.
Valid W3 Document Valid XHTML 1.0 Transitional Valid CSS! The FreeBSD Project Viewable With Any Browser