How to write a script that automates an user setup in Linux using Ubuntu? [closed]











up vote
0
down vote

favorite












Hello I'm asking for assistance creating a script that automates an user setup in Linux Server using Ubuntu?
Also, how to create a script that backups shared files every 12 hours?










share|improve this question















closed as too broad by user535733, waltinator, muru, Eric Carvalho, guntbert Dec 4 at 21:13


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.















  • I'm afraid you may need no add a few details. What do you mean automate user setup? For the second question you may look into chron or systemd timers
    – spacelander
    Nov 29 at 18:38








  • 2




    One question per Question, please. What's wrong with the existing adduser application?
    – user535733
    Nov 29 at 18:41










  • Hi, I am trying to automatically add a new user. I am using Ubuntu. I just need a script to automatically add a user to the server.
    – Seniya Lee
    Nov 29 at 18:46










  • also, the second question Ive figured out how to use the crontab -e command, i am just needing help on the actual script that will backup the files every 12 hours.
    – Seniya Lee
    Nov 29 at 18:47










  • @user535733 nothing is wrong with the adduser application. its working fine in the terminal. I am able to create a new user and a new password, however I actually need the script.
    – Seniya Lee
    Nov 29 at 18:48















up vote
0
down vote

favorite












Hello I'm asking for assistance creating a script that automates an user setup in Linux Server using Ubuntu?
Also, how to create a script that backups shared files every 12 hours?










share|improve this question















closed as too broad by user535733, waltinator, muru, Eric Carvalho, guntbert Dec 4 at 21:13


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.















  • I'm afraid you may need no add a few details. What do you mean automate user setup? For the second question you may look into chron or systemd timers
    – spacelander
    Nov 29 at 18:38








  • 2




    One question per Question, please. What's wrong with the existing adduser application?
    – user535733
    Nov 29 at 18:41










  • Hi, I am trying to automatically add a new user. I am using Ubuntu. I just need a script to automatically add a user to the server.
    – Seniya Lee
    Nov 29 at 18:46










  • also, the second question Ive figured out how to use the crontab -e command, i am just needing help on the actual script that will backup the files every 12 hours.
    – Seniya Lee
    Nov 29 at 18:47










  • @user535733 nothing is wrong with the adduser application. its working fine in the terminal. I am able to create a new user and a new password, however I actually need the script.
    – Seniya Lee
    Nov 29 at 18:48













up vote
0
down vote

favorite









up vote
0
down vote

favorite











Hello I'm asking for assistance creating a script that automates an user setup in Linux Server using Ubuntu?
Also, how to create a script that backups shared files every 12 hours?










share|improve this question















Hello I'm asking for assistance creating a script that automates an user setup in Linux Server using Ubuntu?
Also, how to create a script that backups shared files every 12 hours?







command-line bash scripts






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 29 at 19:01









Cyrus

3,0882922




3,0882922










asked Nov 29 at 18:32









Seniya Lee

1




1




closed as too broad by user535733, waltinator, muru, Eric Carvalho, guntbert Dec 4 at 21:13


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as too broad by user535733, waltinator, muru, Eric Carvalho, guntbert Dec 4 at 21:13


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • I'm afraid you may need no add a few details. What do you mean automate user setup? For the second question you may look into chron or systemd timers
    – spacelander
    Nov 29 at 18:38








  • 2




    One question per Question, please. What's wrong with the existing adduser application?
    – user535733
    Nov 29 at 18:41










  • Hi, I am trying to automatically add a new user. I am using Ubuntu. I just need a script to automatically add a user to the server.
    – Seniya Lee
    Nov 29 at 18:46










  • also, the second question Ive figured out how to use the crontab -e command, i am just needing help on the actual script that will backup the files every 12 hours.
    – Seniya Lee
    Nov 29 at 18:47










  • @user535733 nothing is wrong with the adduser application. its working fine in the terminal. I am able to create a new user and a new password, however I actually need the script.
    – Seniya Lee
    Nov 29 at 18:48


















  • I'm afraid you may need no add a few details. What do you mean automate user setup? For the second question you may look into chron or systemd timers
    – spacelander
    Nov 29 at 18:38








  • 2




    One question per Question, please. What's wrong with the existing adduser application?
    – user535733
    Nov 29 at 18:41










  • Hi, I am trying to automatically add a new user. I am using Ubuntu. I just need a script to automatically add a user to the server.
    – Seniya Lee
    Nov 29 at 18:46










  • also, the second question Ive figured out how to use the crontab -e command, i am just needing help on the actual script that will backup the files every 12 hours.
    – Seniya Lee
    Nov 29 at 18:47










  • @user535733 nothing is wrong with the adduser application. its working fine in the terminal. I am able to create a new user and a new password, however I actually need the script.
    – Seniya Lee
    Nov 29 at 18:48
















I'm afraid you may need no add a few details. What do you mean automate user setup? For the second question you may look into chron or systemd timers
– spacelander
Nov 29 at 18:38






I'm afraid you may need no add a few details. What do you mean automate user setup? For the second question you may look into chron or systemd timers
– spacelander
Nov 29 at 18:38






2




2




One question per Question, please. What's wrong with the existing adduser application?
– user535733
Nov 29 at 18:41




One question per Question, please. What's wrong with the existing adduser application?
– user535733
Nov 29 at 18:41












Hi, I am trying to automatically add a new user. I am using Ubuntu. I just need a script to automatically add a user to the server.
– Seniya Lee
Nov 29 at 18:46




Hi, I am trying to automatically add a new user. I am using Ubuntu. I just need a script to automatically add a user to the server.
– Seniya Lee
Nov 29 at 18:46












also, the second question Ive figured out how to use the crontab -e command, i am just needing help on the actual script that will backup the files every 12 hours.
– Seniya Lee
Nov 29 at 18:47




also, the second question Ive figured out how to use the crontab -e command, i am just needing help on the actual script that will backup the files every 12 hours.
– Seniya Lee
Nov 29 at 18:47












@user535733 nothing is wrong with the adduser application. its working fine in the terminal. I am able to create a new user and a new password, however I actually need the script.
– Seniya Lee
Nov 29 at 18:48




@user535733 nothing is wrong with the adduser application. its working fine in the terminal. I am able to create a new user and a new password, however I actually need the script.
– Seniya Lee
Nov 29 at 18:48










2 Answers
2






active

oldest

votes

















up vote
1
down vote













#!/bin/bash
# argument 1 is the user8d

useradd -U -m $1

exit 0


save the file as user.sh , type chmod a+x user.sh to make it executable
use it like this : sudo ./user.sh foobarr
this will create a user foobar with home directory /home/foobar and they will be in group foobar useradd will create the group foobar



if you want to set the password you need to use crypt
you may want to change the defaults for useradd to research it's capabilities try man useradd. the documentation says debian users which ubuntu is should use adduser, i'd advise against this in a script as there is an interactive section to the user creation process with adduser






share|improve this answer




























    up vote
    0
    down vote













    To create users and set their password via commandline with
    no questions asked the following script would work:



    #!/usr/bin/env bash
    adduser --disabled-password --gecos 'Seniya Lee' lee
    echo "lee:buzzword" | chpasswd


    Save this as au.sh for instance, make it executable
    (chmod +x au.sh), and run it via sudo ./au.sh.






    share|improve this answer





















    • your setting of a password doesn't work. i get aa token manipulatu#ion error and it fails, should buzzword not be the string created by cryptwhen called with a salt and password
      – rhubarbdog
      Nov 29 at 20:26






    • 1




      @rhubarbdog The whole script must be run with sudo. Or separately: sudo adduser… and then echo "…" | sudo chpasswd (not sudo echo … | chpasswd). /// And yes, of course it is better to not set cleartext passwords from the commandline but that wasn't part of the question.
      – PerlDuck
      Nov 29 at 20:29




















    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    #!/bin/bash
    # argument 1 is the user8d

    useradd -U -m $1

    exit 0


    save the file as user.sh , type chmod a+x user.sh to make it executable
    use it like this : sudo ./user.sh foobarr
    this will create a user foobar with home directory /home/foobar and they will be in group foobar useradd will create the group foobar



    if you want to set the password you need to use crypt
    you may want to change the defaults for useradd to research it's capabilities try man useradd. the documentation says debian users which ubuntu is should use adduser, i'd advise against this in a script as there is an interactive section to the user creation process with adduser






    share|improve this answer

























      up vote
      1
      down vote













      #!/bin/bash
      # argument 1 is the user8d

      useradd -U -m $1

      exit 0


      save the file as user.sh , type chmod a+x user.sh to make it executable
      use it like this : sudo ./user.sh foobarr
      this will create a user foobar with home directory /home/foobar and they will be in group foobar useradd will create the group foobar



      if you want to set the password you need to use crypt
      you may want to change the defaults for useradd to research it's capabilities try man useradd. the documentation says debian users which ubuntu is should use adduser, i'd advise against this in a script as there is an interactive section to the user creation process with adduser






      share|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        #!/bin/bash
        # argument 1 is the user8d

        useradd -U -m $1

        exit 0


        save the file as user.sh , type chmod a+x user.sh to make it executable
        use it like this : sudo ./user.sh foobarr
        this will create a user foobar with home directory /home/foobar and they will be in group foobar useradd will create the group foobar



        if you want to set the password you need to use crypt
        you may want to change the defaults for useradd to research it's capabilities try man useradd. the documentation says debian users which ubuntu is should use adduser, i'd advise against this in a script as there is an interactive section to the user creation process with adduser






        share|improve this answer












        #!/bin/bash
        # argument 1 is the user8d

        useradd -U -m $1

        exit 0


        save the file as user.sh , type chmod a+x user.sh to make it executable
        use it like this : sudo ./user.sh foobarr
        this will create a user foobar with home directory /home/foobar and they will be in group foobar useradd will create the group foobar



        if you want to set the password you need to use crypt
        you may want to change the defaults for useradd to research it's capabilities try man useradd. the documentation says debian users which ubuntu is should use adduser, i'd advise against this in a script as there is an interactive section to the user creation process with adduser







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 29 at 20:23









        rhubarbdog

        20717




        20717
























            up vote
            0
            down vote













            To create users and set their password via commandline with
            no questions asked the following script would work:



            #!/usr/bin/env bash
            adduser --disabled-password --gecos 'Seniya Lee' lee
            echo "lee:buzzword" | chpasswd


            Save this as au.sh for instance, make it executable
            (chmod +x au.sh), and run it via sudo ./au.sh.






            share|improve this answer





















            • your setting of a password doesn't work. i get aa token manipulatu#ion error and it fails, should buzzword not be the string created by cryptwhen called with a salt and password
              – rhubarbdog
              Nov 29 at 20:26






            • 1




              @rhubarbdog The whole script must be run with sudo. Or separately: sudo adduser… and then echo "…" | sudo chpasswd (not sudo echo … | chpasswd). /// And yes, of course it is better to not set cleartext passwords from the commandline but that wasn't part of the question.
              – PerlDuck
              Nov 29 at 20:29

















            up vote
            0
            down vote













            To create users and set their password via commandline with
            no questions asked the following script would work:



            #!/usr/bin/env bash
            adduser --disabled-password --gecos 'Seniya Lee' lee
            echo "lee:buzzword" | chpasswd


            Save this as au.sh for instance, make it executable
            (chmod +x au.sh), and run it via sudo ./au.sh.






            share|improve this answer





















            • your setting of a password doesn't work. i get aa token manipulatu#ion error and it fails, should buzzword not be the string created by cryptwhen called with a salt and password
              – rhubarbdog
              Nov 29 at 20:26






            • 1




              @rhubarbdog The whole script must be run with sudo. Or separately: sudo adduser… and then echo "…" | sudo chpasswd (not sudo echo … | chpasswd). /// And yes, of course it is better to not set cleartext passwords from the commandline but that wasn't part of the question.
              – PerlDuck
              Nov 29 at 20:29















            up vote
            0
            down vote










            up vote
            0
            down vote









            To create users and set their password via commandline with
            no questions asked the following script would work:



            #!/usr/bin/env bash
            adduser --disabled-password --gecos 'Seniya Lee' lee
            echo "lee:buzzword" | chpasswd


            Save this as au.sh for instance, make it executable
            (chmod +x au.sh), and run it via sudo ./au.sh.






            share|improve this answer












            To create users and set their password via commandline with
            no questions asked the following script would work:



            #!/usr/bin/env bash
            adduser --disabled-password --gecos 'Seniya Lee' lee
            echo "lee:buzzword" | chpasswd


            Save this as au.sh for instance, make it executable
            (chmod +x au.sh), and run it via sudo ./au.sh.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 29 at 20:06









            PerlDuck

            5,07911230




            5,07911230












            • your setting of a password doesn't work. i get aa token manipulatu#ion error and it fails, should buzzword not be the string created by cryptwhen called with a salt and password
              – rhubarbdog
              Nov 29 at 20:26






            • 1




              @rhubarbdog The whole script must be run with sudo. Or separately: sudo adduser… and then echo "…" | sudo chpasswd (not sudo echo … | chpasswd). /// And yes, of course it is better to not set cleartext passwords from the commandline but that wasn't part of the question.
              – PerlDuck
              Nov 29 at 20:29




















            • your setting of a password doesn't work. i get aa token manipulatu#ion error and it fails, should buzzword not be the string created by cryptwhen called with a salt and password
              – rhubarbdog
              Nov 29 at 20:26






            • 1




              @rhubarbdog The whole script must be run with sudo. Or separately: sudo adduser… and then echo "…" | sudo chpasswd (not sudo echo … | chpasswd). /// And yes, of course it is better to not set cleartext passwords from the commandline but that wasn't part of the question.
              – PerlDuck
              Nov 29 at 20:29


















            your setting of a password doesn't work. i get aa token manipulatu#ion error and it fails, should buzzword not be the string created by cryptwhen called with a salt and password
            – rhubarbdog
            Nov 29 at 20:26




            your setting of a password doesn't work. i get aa token manipulatu#ion error and it fails, should buzzword not be the string created by cryptwhen called with a salt and password
            – rhubarbdog
            Nov 29 at 20:26




            1




            1




            @rhubarbdog The whole script must be run with sudo. Or separately: sudo adduser… and then echo "…" | sudo chpasswd (not sudo echo … | chpasswd). /// And yes, of course it is better to not set cleartext passwords from the commandline but that wasn't part of the question.
            – PerlDuck
            Nov 29 at 20:29






            @rhubarbdog The whole script must be run with sudo. Or separately: sudo adduser… and then echo "…" | sudo chpasswd (not sudo echo … | chpasswd). /// And yes, of course it is better to not set cleartext passwords from the commandline but that wasn't part of the question.
            – PerlDuck
            Nov 29 at 20:29





            Popular posts from this blog

            Quarter-circle Tiles

            build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

            Mont Emei