A script to create user

2011-06-12  来源:本站原创  分类:OS  人气:66 

In as Administrator, from time to time will need to create users, but to create more user command parameters, so write a script to implement quickly create add_user.sh users.

#!/bin/bash

if [ $# -ne 1 ]; then
    echo "Usage: $0  user-name"
    exit -1
fi

# create a user
useradd -g users -s /bin/bash -d /home/$1 -m  $1

# set the password
echo $1:$1 | chpasswd

create user in Linux useradd command:
-G users that the user belongs to users group
-S / bin / bash bash that users are logged on with
-D / home / $ 1 means that the user's home directory is created in / home /, the directory name with the same user name.
-M means that the user's home directory does not exist automatically created. Under normal circumstances no users, certainly not directory.
The final $ 1 is used to specify the user name created

Newly created user has no password, so by chpasswd command to specify the password with the username.

When you need to create user xyz, only to execute commands as root

./add_user.sh  xyz

Can.

相关文章
  • linux shell script to create systems with the FTP account 2010-03-09

    Following SHELL script to create a more complete FTP account, including: 1) The new FTP account and directory 2) FTP account password changes 3) FTP account directory, create three subdirectories, different data storage 4) The directory permissions s

  • Script to create non-unique index method 2010-07-02

    Export script creates non-unique index method In the ORACLE exp in a logical backup tools to export data, if you use the default parameters, the index will guide them along. When the data and the index is small, we may not be accounting more into tim

  • [Zhuantie] export script to create the methods of non-unique index 2010-12-29

    Export script creates non-unique index method In the ORACLE exp in a logical backup tool to export data, if the default parameters, the statement will create the index with the guide out. When the data and index small, We may not import more time acc

  • Detailed: Database name instance name. ORACLE_SID. Database domain, and the global database name service name and a script to create oracle database manually 2011-09-21

    Database name, instance name, database name, global database name, service name, These are a few confusing to many beginners concept. I believe a lot of beginners like me to be the title with a concept and made a loss on these. Let us now get hold of

  • A script to create user 2011-06-12

    In as Administrator, from time to time will need to create users, but to create more user command parameters, so write a script to implement quickly create add_user.sh users. #!/bin/bash if [ $# -ne 1 ]; then echo "Usage: $0 user-name" exit -1 f

  • Non-tax collection system host file perl script to create reconciliation 2010-03-30

    Non-tax collection system, the host needs automatically generated every night Reconciliation text text format, so the preparation of the following perl script, adding crontab, let it run automatically every day. #!/usr/bin/perl # createDuizhangText.p

  • Create tablespace script automation 2010-12-11

    /*================================================ ====================/ # # Description: # # Create a database user script # # Default create user: username / password # # Username = username # # Password = password # # Schema = username (table spac

  • Ruby on Rails and to use Action Web Service to create Web Services 2009-05-25

    Action Web Service Module will be at Ruby on Rails implementation of Web services. Action Web Service will be the creation of SOAP and XML-RPC Web Services in support of server-side protocol. You can use the Declaration and the Action Web Service rel

  • linux systems using shell scripts to create FTP account 2010-03-09

    Following SHELL script to create a more complete FTP account, including: 1) The new FTP account and directory 2) FTP account password changes 3) FTP account directory, create three subdirectories, different data storage 4) The directory permissions s

  • Creating oracle data using powerdesigner script problem 2010-04-13

    Today, the use of powerdesigner create oracle data script, the client plsql in oracle database script to create a database to run, no exception to this point. But when you insert the test data is always prompt field "***"**** tips (hey, mistakes

  • Linux GUI script zenity 2010-05-14

    zentiy can help you use the script to create a common gtk + dialog. 1, using the calendar control: szDate = $ (zenity - calendar - text "Pick a day" - title "Medical Leave" - day 13 - month 5 - Year 2010); echo $ szDate 2, create a Ent

  • Steps to create a database manually Oracle 2010-05-13

    In addition to native Oracle DBCA to create a database that, there is another way to create, is to manually create the database, but also as a DBA must be mastered. To introduce the following steps to manually create the database: Manually create a d

  • DBA_Oracle manually create the database 2010-05-14

    1. To create an instance: oradim-NEW-SID book 2. Ready to initialization parameter file: INIT <SID>. ORA copy replace instance name 3. Check the appropriate directory structure exists: there is no attention undo_tablespace =''create their own conten

  • JavaScript ---- create reusable code 2010-08-27

    1.1, the prototype inheritance JavaScript object creation and inheritance of a particular model used, called the prototype inheritance. The principle of this method is the constructor object can inherit methods from other objects, it creates a protot

  • [007] [042] create a library, have done? 2010-09-07

    When using dbca to create database, dbca have done what operation? In Liunx5 + oracle10.1.0 and do the following analysis, and the windows under slightly different. First of all, building a database by dbca script, the concrete operation is as follow

  • Oracle database, several major steps to manually create 2010-09-16

    http://database.51cto.com/art/201002/184885.htm Manually create a database usually contains the following steps : 1. Determine the new database name and the instance name : 2. Determine the database administrator authentication method : 3. Creating i

  • oracle table partition and operation of the script notes 2010-09-29

    --oracle Table partition script cheat CREATE TABLE t_partition_exam ( STATDATE CHAR(8 BYTE) NOT NULL, ..., ACCOUNT_ITEM VARCHAR2(14 BYTE) NOT NULL ) TABLESPACE ZHJSFX_USER PCTUSED 0 PCTFREE 10 INITRANS 1 MAXTRANS 255 NOLOGGING PARTITION BY RANGE (STA

  • jquery's approach to style html tags and script tags 2010-10-07

    html jquery method handled the various situations Script to create the corresponding script object, set the type attribute, if the data is remote, set the src If the inline script, ie set the text property for the script to execute firefox upper appe

  • Create a simple rails application 2010-10-20

    Start tour rails 1, create the application D: \ ror> rails new myapp create create README create Rakefile create config.ru create. gitignore create Gemfile create app create app / controllers / application_controller.rb create app / helpers / applica

  • Create Div JavaScript 2010-11-15

    JavaScript and style attributes to create div tags: javascript create div's properties and style of the problem domain: How to create a div node element from the JavaScript: Create a div element attribute node; Div style created node element; Solutio