There are several ways to create a password protection script for Linux. One common method is to use the "passwd" command in a shell script. This command can be used to change the password for a user account.
Here is an example of a simple password protection script:
#!/bin/bash
echo "Enter the username:"
read username
echo "Enter the new password:"
read -s password
echo $password | passwd --stdin $username
This script prompts the user to enter a username and a new password, and then uses the "passwd" command to change the password for the specified user.
You can also use other tools like python,bash-scripting,Perl,Java to create a password protection script.
You might also want to consider using a tool such as PAM (Pluggable Authentication Modules) to authenticate users. PAM allows you to use a variety of authentication methods, such as password, SSH keys, or biometrics, and it can be easily configured to work with various types of applications and services.