This is a small tip when dealing with interactive shell scripting on how to hide sensitive information displaying on the terminal. Scenario: Suppose you want to connect some site using username and password in a shell script, you can use read command to take input from a user. By default whatever you type read command will print in plain text on the screen. This is a security issue, and we have to hide that sensitive information not to write on the screen. Example: My code in my script is read -p "Please provide bitbucket username(Ex. surendra.anne): " userName read -p "Please provide bitbucket password: " passWord Output when executing the entire script: [email protected]:~$ bash push_fpga.sh Please provide bitbucket username(Ex. surendra.anne): surendra.anne Please provide bitbucket password: XYZabc123 --2017-03-21 12:50:30-- https://bitbucket.org/linuxnix/sw_daffy/downloads/mypackage.tar.gz Resolving bitbucket.org (bitbucket.org)... 220.127.116.11, 18.104.22.168, 22.214.171.124, ... Connecting to bitbucket.org (bitbucket.org)|126.96.36.199|:443... connected. HTTP request sent, awaiting response... 401 Unauthorized Authentication selected: Basic realm="Bitbucket.org HTTP" Reusing existing connection to bitbucket.org:443. HTTP request sent, awaiting response... 302 Found Location: https://bbuseruploads.s3.amazonaws.com/adsfawdfas/downloads/qerqdfasdf/mypackage.tar.gz?Signature=nGupkqNe8Da9ZfGJMfrBN5ljAq8%3D&Expires=1490062832&AWSAccessKeyId=qerzxcqew&versionId=Hwf0V2olr_g.7OGBuhnLJxy8aYEG4bBy&response-content-disposition=attachment%3B%20filename%3D%22mypackage.tar.gz%22 [following] --2017-03-21 12:50:32-- https://bbuseruploads.s3.amazonaws.com/adsfawdfas/downloads/qerqdfasdf/mypackage.tar.gz?Signature=nGupkqNe8Da9ZfGJMfrBN5ljAq8%3D&Expires=1490062832&AWSAccessKeyId=qerzxcqew&versionId=Hwf0V2olr_g.7OGBuhnLJxy8aYEG4bBy&response-content-disposition=attachment%3B%20filename%3D%22mypackage.tar.gz%22 Resolving bbuseruploads.s3.amazonaws.com (bbuseruploads.s3.amazonaws.com)... 188.8.131.52 Connecting to bbuseruploads.s3.amazonaws.com (bbuseruploads.s3.amazonaws.com)|184.108.40.206|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 1494336 (1.4M) [application/x-tar] Saving to: '/tmp/mypackage.tar.gz’ mypackage.tar.gz 100%[=======================================================>] 1.42M 231KB/s in 7.3s 2017-03-21 12:50:41 (201 KB/s) - '/tmp/mypackage.tar.gz’ saved [1494336/1494336] If you observe the password(XYZabc123) for my account is plain text. This can be avoided using the silent option with the...Read More
Month: March 2017
In this tutorial, we will use some commands that help us to find files in Linux. These commands are: echo ls find whereis locate List files using echo command Many people are not aware of echo command potential. This will come very handy when listing files in a given directory where ls, find and other commands are not available in rescue mode. This is because echo is a built-in command and available in any basic Linux machine. The echo command uses Bash shell expansion to list files in a given directory. To list files in a given directory use below command. [10:23:38] [VPS1-centos7] root:/bin # echo *test gr2fonttest grub2-fstest mysqltest sctp_test View files using ls command The simplest way is to use ls command if you are looking inside a directory of files [10:23:38] [VPS1-centos7] root:/bin # ls *test* gr2fonttest grub2-fstest gtester gtester-report mysqltest sctp_test snmptest test testgdbm testparm varnishtest You can use several options with ls. The most used options are : -l : list -a : all files even hidden ones -h : human readble -r : reverse order while sorting -t : sorts output based on the date of modification of the file [10:28:07] [VPS1-centos7] root:/bin # ls -ltr *test* -rwxr-xr-x. 1 root root 30488 Jun 9 2014 testgdbm -rwxr-xr-x. 1 root root 32520 Jun 10 2014 sctp_test -rwxr-xr-x. 1 root root 147576 Mar 16 2015 varnishtest...Read More
Hello to all from Linux Juggernaut team. We are excited to introduce our multiple WhatsApp groups related to IT infrastructure today. Please join in one or more groups which are appropriate for you. The system administration field had moved towards devops field a couple of years back. Devops field is the one which is changing quickly with the advent of Cloud technologies and large open source deployments across IT. One person can not cope up with so much new stuff happening in Devops field. The intention of these groups are for information consumption such as Sharing knowledge and issues you face. Learning...Read More
Get more stuff like this
in your inbox
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Thank you for subscribing.
Something went wrong.
we respect your privacy and take protecting it seriously
How to setup prometheus monitoring tool on Centos 7Nov 16, 2017 | Open Source
My name is Surendra Kumar Anne. I hail from Vijayawada which is cultural capital of south Indian state of Andhra Pradesh. I am a Linux evangelist who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. At present I work at Bank of America as Sr. Analyst Systems and Administration. You can contact me at surendra (@) linuxnix dot com.