Shell Script to Create Computer Users (SSCCU)



AVAILABLE:    5

Around the second semester, our lecturer introduced us to a different perspective, focusing on computer security. The lecturer was highly skilled with Linux, and everything was done using this operating system. To demonstrate their expertise, they showed us how to create new users in Linux via the terminal. To make it easier for us to understand, we were given an assignment to create a user-friendly interface with menu options displayed on CMD, terminal, or similar environments. Below is the result.

Program:

#!/bin/sh
#12131294.sh
#autouser
#date: 17/05/14

for i in $(ls); do
  echo "--------------------------"
  echo "--------------------------"
  echo "1. Input username"
  echo "2. Auto-create user"
  echo "3. Auto-delete user"
  echo "4. Exit"
  echo -n "Choice: "
  read PILIH
  case $PILIH in
  1)
    echo -n "Username: "
    read un
    ;;
  2)
    sudo useradd $un
    ;;
  3)
    sudo userdel $un
    ;;
  4)
    exit
    ;;
  *)
    echo "Sorry, the option you selected is not available!"
    ;;
  esac
done

Output:

Contoh Shell Membuat User Komputer

Hope this helps and happy learning!


Post a Comment

Previous Next

نموذج الاتصال