• Arun Kumar

Shell Script User Login with Password

We can create a bash script to authenticate users with login and password. Here we will demonstrate this using the read command to accept the user input and the if-else command to authenticate.

vi user_login.sh
# !/bin/bash
#Type your login details
read -p 'Username: ' user
read -sp 'Password: ' pass

if (( $user == "admin" && $pass == "admin123" ))
	echo -e "\nWelcome! You are Sucessfull login\n"
	echo -e "\nUnsuccessful login\n"

Here is the sample of the output of the above script.

More ways to use the user login with password

  • You can create more than 1 user and check for their login

  • You can display the user name in the welcome message "Welcome " + username


Recent Posts

See All

Oracle 19c Installation on Linux

Oracle 19c adds more features to Oracle database and this article demonstrates Oracle 19c installation on Linux 7. We will be using Oracle Linux 7 and Oracle Database 19.3 softwares for this activity.

Basic Linux Commands

This article describes basic Linux commands that you must know as a system or database administrator. Below commands in Linux help you manage any Linux server fast and smoothly. Linux Command List Che

Linux Firewall with iptables and firewalld

In this article will be covering details regarding iptables and firewalld which helps in Linux firewall management. We will also be looking at how to enable specific ports (1521 for Oracle) inside ipt