SlackAcc

Publicado por Slackjeff (última atualização em 26/01/2018)

[ Hits: 2.151 ]

Homepage: https://slackjeff.com.br

Download slackacc




Crie seu usuario de uma forma fácil usando o dialog.
Pode ser usado em qualquer distribuição desde que tenha o dialog instalado.

  



Esconder código-fonte

#!/bin/bash
#----------HEADER--------------------------------------------------|
#AUTHOR:
# Jefferson Rocha <lrcjefferson@gmail.com>
#
#Program:
# Simple program to Create a USER with useradd and box's dialog.
#------------------------------------------------------------------|

#-------Variables
check_dialog=$(which dialog 2>&-)

#-------FUNCTIONS
status(){
  case $? in
    1)
      user=${user,,}   # lower user, not error.
      pass=$(
      dialog --stdout \
             --insecure \
             --passwordbox "Say your Password!" 0 0)
        [ "$?" = "0" ] && useradd -p "$pass" -m -c "$comment" "$user" && \
        dialog --title "Sucess." --sleep 2 --infobox "User created." 0 0 \
        && exit 1 || \
       dialog --title "Error." --sleep 2 --infobox "Error :(" 0 0 ;;
  esac
}


#-------Inicializing
# Root?
[ $(echo $UID) -ne "0" ] && \
dialog --title "Root now." --infobox "NEED ROOT." 0 0 && exit 1

# Dialog exist in system?
[ ! -e "$check_dialog" ] && echo -e "\033[31;1mInstall Dialog.\033[m" && exit 1



#--------Here start.
while :; do
  { read user; read pass; read comment; read shell; } \
  < <(dialog --stdout       \
             --no-cancel    \
             --backtitle "Slackware Create User" --title "Create a New User" \
             --no-shadow    \
             --form "Users" \
             0 0 0          \
             "User:"     1 1 ""          1 10 25 25 \
             "Comment:"  2 1 ""          2 10 25 25 )
status   # Function call
done      # END LOOP WHILE

Scripts recomendados

Abrindo Sessão Cluster Beowulf

Instalador do Java JRE Oracle

Cotação de Criptomoedas

Script que conta quantas barras tem em um diretorio

Shell para extrair informações de impressoras Brother


  

Comentários
[1] Comentário enviado por albfneto em 26/01/2018 - 20:39h

muito bom isso. Favoritado!
¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨
Albfneto,
Ribeirão Preto, S.P., Brasil.
Usuário Linux, Linux Counter: #479903.
Distros Favoritas: [i] Sabayon, Gentoo, OpenSUSE, Mageia e OpenMandriva[/i].


Contribuir com comentário




Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts