Results 1 to 7 of 7

Thread: How to create several users via script

  1. #1
    Join Date
    Jun 2009
    Posts
    96

    How to create several users via script

    I am looking for a simple solution to create many users. I found a script on a site named vanhees.cc.

    Code:
    FILE = / root / file_util 
    for i in `cat $ FILE | grep-v ^ #` 
    do 
    USER = `echo $ i | cut-d" | "-f1` 
    SHELL = `echo $ i | cut-d" | "-f2` 
    PASSWD = `echo $ i | cut-d" | "-f3` 
    useradd-s $ SHELL $ USER 
    echo $ PASSWD | passwd - stdin $ USER 
    echo "USER: $ USER Successfully created \ n" 
    done
    It works pretty well, and users are created. But they do not appear in the server-manager. When I create with the script, that's what gives me.
    foo:x:5002:5002::/home/foo:/bin/false
    foo1:x:5003:5003::/home/foo1:/bin/false

    And when I create via server-manager this is what I have
    jn:x:5000:5000:jul nois:/home/e-smith/files/users/jn:/usr/bin/rssh

    Has anyone ever done this kind of manipulation? If so could you enlighten me?

  2. #2
    Join Date
    Jan 2006
    Posts
    3,792

    Re: How to create several users via script

    Without being an expert in SME, I think there is confusion, let me explain:

    According to the script users are created in linux as "normal", as on most distributions of GNU / Linux, type:
    Code:
    #adduser machin
    However, SME is a "special" distribution, this command is not really recommended (I'm wrong?).

    To create a user in SME, we use the panel, which is (I think) to the command:
    Code:
    # signal-event user-create
    This will create a user in SME: $homedir dans /home/e-smith/files/users/ and not in /home/ (as is generally the case in other distribution). In addition, the mail folders are created.

    Afterwards, regarding the creation of users from the command line, without wanting to say something stupid, are the contribs of jbennett: http://wiki.contribs.org/Lazy_Admin_Tools. But I do not know if it the right tool for what you want to do!

    Hence my question: why are you creating multiple users at a time?

  3. #3
    Join Date
    Jun 2009
    Posts
    96

    Re: How to create several users via script

    I just tested Lazy Admin tool and that is what I want. This creates my users and they are appearing in the server manager. Thank you for your explanations on creating user. I knew there was a problem but I could not figure out what. Now, I must create a script that will get me the info in a database. This is a new step!

    To answer your question, why are you creating multiple users at a time?; I need to deploy a webmail for over 400 students. I am no longer in the Small and Medium Enterprise. But I think the distribution SME bear without problem.

  4. #4
    Join Date
    Jan 2006
    Posts
    4,221

    Re: How to create several users via script

    Do not forget that SME is very clever: both mail, samba shares, web internal or external. The set is completely taken with all (major) and its qualities (small) defects, and with sound administration: basic unix users and LDAP-based users (I suppose).

    It is not inconceivable to imagine something different for 400 students: a dedicated solution for messaging that is properly secured (like SME) that manages quotas (SME?), Which is easy to provision ...

  5. #5
    Join Date
    Apr 2008
    Posts
    3,339

    Re: How to create several users via script

    Yes, indeed, it is probably somewhat limited in use.

    Indeed, the creation account in SME creates Samba and other service functions that are not useful in this architecture. But ultimately, if we do not fall into a system limit (there was once limits related to the number of groups could be defined, or the number of group accounts could be a member, knowing that in SME, the admin account is member of all groups, if I remember correctly. But these limits must be outdated now.

    This can be problematic, in my opinion:
    Availability: What to do in case of failure of SME, if the mail is more accessible (no device redundancy 'true' on SME)
    Base account: No, SME does not LDAP authentication, and thus the basic account is necessarily local. This means that if by chance, it is necessary to authenticate on another system.
    Backup / restoration: how to save or restore a single mailbox, etc. ...

    For your account creation, I'd rather say to export the database into a file format 'import' of Lazy Admin Tools' unless of course you want to create accounts 'on the fly', for example, each entry of a new student

  6. #6
    Join Date
    Nov 2009
    Location
    Orlando, FL
    Posts
    2

    Re: How to create several users via script

    Halyn

    I would highly suggest you don't use that script on SME Server.

    The script was designed for distro's other then SME.

    SME has very special requirements and methods that are exclusive to SME.

    There is however a script on the SME site that can be used to do what you want.

    I was looking for it myself when I came accross your post.

    I just firgured I better warn you.

    As a point of reference, in most every case, scripts and apps will not run or setup as they do on other distros, nothing will work without modification and following the sme methods.

    The reason is simply, sme uses a templating system, which you need to understand in order to accomplish things.

    SME is the only server distro with the templating system (automated configuration) of this type.

    I would also suggest you don't delete any user you have already created so far, if you do, you will not be able to use that user name again on the server.

    There are ways to fix the user, search the sme site wiki, I don't have the info at hand, right now.

    Search for "user create" & "user create script" http://wiki.contribs.org/Main_Page

    If and when I find the script I'll post it here.

    Feel free to PM anytime, there is some info that is not appropriate to post at this time that you maybe interested in.

    hth

  7. #7
    Join Date
    Nov 2009
    Location
    Orlando, FL
    Posts
    2

    Re: How to create several users via script

    Here ya go...

    http://www.tech-geeks.org/contrib/lo...s/batch_users/

    I knew I had seen it somewhere, it's an old app Abe had done.

    You will see it's not standard stuff.

    Also I remember a small script that just added a single user.

    When I find it.....

    hth

Similar Threads

  1. Script to list users who Are connected
    By Ron1 in forum Networking & Security
    Replies: 3
    Last Post: 11-09-2009, 02:31 PM
  2. Batch script to move users to different OUs
    By Serrix in forum Active Directory
    Replies: 5
    Last Post: 23-12-2008, 06:45 PM
  3. Logon Script failing, on some users
    By Donnell in forum Active Directory
    Replies: 1
    Last Post: 28-05-2008, 10:53 PM
  4. Add users to Group via Script - [WP]
    By ABRIELLE in forum Active Directory
    Replies: 4
    Last Post: 29-01-2008, 07:54 PM
  5. Add users to local admin via login script
    By Allanoo in forum Active Directory
    Replies: 3
    Last Post: 26-04-2006, 09:59 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,140,273.22180 seconds with 16 queries