Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

Bash script to authenticate machine users

echo
echo '============== User Authenticator =============='
echo

if [[ -z $1 ]]; then
        echo "ERROR: enter username like: './script foo'"
        echo

elif [[ -n $1 ]]; then
echo

echo -e "Enter file name: c"
read -r Uname
echo "Results location: '~/$Uname'"

touch ~/$Uname

Uresult=`cat /etc/passwd | grep $1`
IFS=:

set $Uresult
echo "Username: $1" | tee -a ~/$Uname
echo "Pass: $(sudo cat /etc/shadow | grep $1 | awk -F: '{print $2}')" | tee -a ~/$Uname
echo "UID: $3" | tee -a ~/$Uname
echo "GID: $4" | tee -a ~/$Uname
echo "Directory: $6" | tee -a ~/$Uname
echo "Shell: $7" | tee -a ~/$Uname
echo >> ~/$Uname
echo

fi
Comment

PREVIOUS NEXT
Code Example
Shell :: cht.sh install 
Shell :: hidden files filsize in linux 
Shell :: powershell symlink python as python3 
Shell :: compilation failed for package in r ubuntu 
Shell :: brew install spectacle 
Shell :: git clone with new name 
Shell :: docker container commands 
Shell :: ssh debug 
Shell :: linux directories 
Shell :: debian make directory 
Shell :: gitignore still tracking files 
Shell :: fatal error: hiredis.h: aucun fichier ou dossier de ce type 
Shell :: delete typeeset variable bash 
Shell :: ssh into rpi 0 
Shell :: rollup emotion 
Shell :: Basic Authorization failed for user 
Shell :: batch file code to remove windows activate watermark 
Shell :: apt get install pillow for odoo 
Shell :: Installing nano on Debian/Ubuntu machines 
Shell :: ls sort size descend 
Shell :: sed replace environment escape 
Shell :: MongoInvalidArgumentError: Argument "docs" must be an array of documents 
Shell :: 7zip split archive command line fat32 
Shell :: how to hash a password in bash script 
Shell :: bash ps3 newline 
Shell :: Check servers availability using bash script 
Shell :: Returning Different Color Output (macOS [12.3.1] bash [5.1.16] gnu awk [5.1]) 
Shell :: erc20 token openzeppelin example github 
Shell :: fedora netflix 
Shell :: windows command count output lines 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =