Verify you can ssh to a list of hosts using keys

for i in `cat list` 
do 
    ssh -o "BatchMode yes" root@$i hostname
done

ssh to a list of hosts and run the hostname command to verify you can ssh to the hosts password-lessly. If password-less login is not working, it will not prompt for passphrase or password and will skip it.

man ssh_config

BatchMode
If set to “yes”, passphrase/password querying will be disabled. This option is useful in scripts and other batch jobs where no user is present to supply the password. The argument must be “yes” or “no”. The default is “no”.

Advertisements

How I install miniDLNA on CentOS 7.1 and stream local media to Chromecast

Its 2015 and I am really tired of copying movies to pen drive for watching on TV. Thanks to Chromecast on TV, Localcast App on phone and miniDLNA on laptop, I can flawlessly stream media from phone or laptop to TV. And yes, subtitle is working. With HDMI CEC support I can play and pause from TV remote as well. With YuppTV app I can stream Indian TVs well. These are the steps I followed to install and configure miniDLNA on my Acer netbook running CentOS 7.1.

Install Nux Desktop repository

wget http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop- release-0-1.el7.nux.noarch.rpm
sudo yum localinstall -y nux-dextop-release-0-1.el7.nux.noarch.rpm
sudo rpm –import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
sudo yum repolist
Continue reading

Geek Quotes- In 1989, they thought /etc was a typo

“….I remember a friend of mine telling me that he was drilling holes in the handle of his toothbrush before leaving for a long hiking trip, in order to reduce as much as possible the weight to carry.”

From Cisco Unified Computing System (UCS) (Data Center): A Complete Reference Guide to the Cisco Data Center Virtualization Server Architecture Continue reading

Input-output redirection in Linux

command file Sends output to file
command >> file Appends output to file
command 2> file Sends error to file
command 2>> file Sppends error to file
command > file 2>&1 Sends output and error to file
command >> file 2>>&1 Sppends output and error to file
command1 | command2 Output of command1 becomes the input of command2
command | tee file Sends output to both file and screen
0,1,and 2 are the file descriptor for stdin, stdout and stderr respectively

When you run a command, input is expected from the standard input which is the keyboard. The output and error messages go the standard output which is the screen. Input can come from a file or other command. This is called input redirection.

We can send the output to a file instead of the screen. This is called output redirection. We can do the same with error. We use piping to send the output of a command as input to another command.

Access a shell prompt and issue commands with correct syntax

While preparing for RHCE RHEL 6 (available upto March 31, 2016), I came across this website which does an easy to follow cheat sheet of sort for each topics under the RHCE/RHCSA Exam objectives. I was hugely impressed and wanted to do something similar. This is my attempt at creating a cheat sheet for RHCE/RHCSA RHEL 7.

Now to the topic. Anyone attempting RHCE should already know how to launch a terminal to access the shell and run commands. If you are really that fresh to Linux, among the many many resources available online I recommend Daniel Robin’s Linux Fundamental series and Introduction to Linux by the Linux Foundation at EdX.
Continue reading