## Previous Command's All Arguments
## Previous Command's Last Argument
or even use $_ instead of !$
## Previous Command's First Argument
cd `Esc` `.`
Pressing Esc followed by . will give previous arguments
## "More Options"
!^ first argument
!$ last argument
!* all arguments
!:2 second argument
!:2-3 second to third arguments
!:2-$ second to last arguments
!:2* second to last arguments
!:2- second to next to last arguments
Problem Statement: I want to SSH into a list of hosts from the browser(from a host monitoring UI).
Note: At this point of time, we did not have Service Discovery present.
To identify this, in our team, we maintained a single service which has this list. The service is responsible for
bunch of things including displaying host metrics, checking health statuses, disk space, querying the LB status for the service/port.
A regular deployment usually consists of updating a puppet script and running a puppet command on all servers in batches of 20% at a time.
When you start dealing with multiple hosts, you realize you want to use a utility command like csshX which opens multiple windows. Though this is limited by the configuration file or copy/pasting the host list.
I wanted to pass on this host list data from the browser and with a click of a link, the user should be able to get the list of hosts.
Now if you have a link like csshx://127.0.0.1%20127.0.0.2%20127.0.0.3 , it will open 3 shells using the csshX command installed passing it as csshX 127.0.0.1 127.0.0.2 127.0.0.3. The protocol handler transfers the ownership in a very clean way.
Security Warning: Beware about any URL injections that may happen while using this. As long as you trust the source, you should be good.
# $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options change a
# default value.
Default system level configuration
Change the default port from 22.
I don’t really know what this is
There are can be associate this with either a single address or all the addresses the system has. This is important if your server is part of two networks so that you can use only one of the addresses to bind it to.
SSH Protocol to use
# Disable legacy (protocol version 1) support in the server for new
# installations. In future the default will change to require explicit
# activation of protocol 1
Host Key is something to uniquely identify a host.
# HostKey for protocol version 1
# HostKeys for protocol version 2
# Lifetime and size of ephemeral version 1 server key
Log files is the veins of the system. If things go bad, this is where you need to look. Describe what kind of logging should be done
# obsoletes QuietMode and FascistLogging
Self explanatory, paranoia in case you don’t want to hit your too often with password retries
Public key authentication for safe and secure way. Generate an RSA token which will generate id_rsa (the private key and should not be shared) and id_rsa.pub(your public key, can be passed on to system where you want to login into).
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
# similar for protocol version 2
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
# Don't read the user's ~/.rhosts and ~/.shosts files
Keyboard based authentication of password from the client. If you feel too lazy to type a password all the time see public key authentication section
# To disable tunneled clear text passwords, change to no here!
# Change to no to disable s/key passwords
Kerberos is a network login system which is usually used in a medium to big organisations having network logins and multiple servers. If its 2-3 users and couple of servers that share passwords, its better off not setting Kerberos like systems.
# Kerberos options
You don’t want this in a normal server since the handshake itself eats up lot of time. Setting to no disables it
# GSSAPI options
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
Other custom settings with which you can use the power of SSH and remote system
If you want to open a Firefox from a different server. enable to ‘yes’
Print message of the day
Enabled by default to let the user know when s/he was logged in last.
This is helpful for not timing out the user
Tunnel is used for using the ssh server as a proxy
Chroot is a bigger concept which is to restrict environments / environment configuration with dependencies so that they do not interact with the rest of the system. Its like a Virtual Machine in your computer which does not know if its a Virtual Machine or a real server.
Display information aka banner on what to do, what not, what the server has etc after logging in.
# no default banner path
# override default of no subsystems
Subsystem sftp /usr/libexec/openssh/sftp-server
If you want to allow a user to do something or not to do something, this is the place to put it
# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# ForceCommand cvs server