Shell: May 2016 Archives

XML formating

user-pic
Vote 0 Votes

| xmllint --format - # need libxml2 package
| xmlstarlet fo # need xmlstarlet
Make it more readable.

JSON formating

user-pic
Vote 0 Votes

| python -m json.tool # need python package
| jq . # need jq package
Make it more readable.

Server Side sshd_config
ClientAliveInterval 60
ClientAliveCountMax 3

or

Client Side ssh_config
ServerAliveInterval 60

ssh user@host bash -s -- < local-script.sh

You can add arguments if you need.
ssh user@host bash -s -- < local-script.sh argv1

sshpass

user-pic
Vote 0 Votes

一般是建 Key 來達成 ssh 免密碼, 若不想建 Key, 可以用 sshpass
sshpass 可以在 ssh 時自動將密碼帶入
密碼可以用檔案(-f filename)或參數(-p password)或變數SSHPASS(-e)帶入
e.g.
sshpass -f pass_file ssh user@somewhere.com
sshpass -p password ssh user@somewhere.com
export SSHPASS=password
sshpass -e user@somewhere.com
當然也可以直接執行所連線主機的 command
sshpass -e user@somewhere.com cat /etc/hosts

About this Archive

This page is an archive of entries in the Shell category from May 2016.

Shell: April 2016 is the previous archive.

Shell: June 2016 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Monthly Archives