Linux Tools
Contents
Connection
It is convenient to control a few machines from one screen. Typically ssh is used for this purpose, but if security is not a concern (e.g. then the network is strictly local) telnet can be also used as a quick solution. You may find it useful to utilize telnet at first in order to access all computers from one location when setting up ssh. Another advantage of ssh is X11 forwarding, which functionality telnet does not have.
nslookup
This is a very useful network information utility with diverse functionality. One simple function is to translate qualified host names to IP addresses and back.
ssh
You'll need to run the sshd service on every machine you want to connect to. On Linux, this is most frequently openssh-server and it can be trivially installed. To be used productively, private and public keys will need to be generated or imported as necessary. For the private/public key pair to work, public keys should be added to the file ".ssh/authorized_keys". A matching private key must be loaded to an identity managing service (e.g. ssh-agent in case of Linux) on the machine from which you are going to connect. If it's not cached, you will likely be prompted to enter the passphrase for the key.
Typically (this depends on the flavor of your sshd) you will get a message specifying which public key is used during the login that you are attempting. This is useful to know if you have many keys and forget which was used for what connection.
Restarting the service:
sudo systemctl restart ssh
Adding a key to the agent:
eval "$(ssh-agent -s)" ssh-add key_file
Tunneling at BNL:
ssh -L 8080:130.199.23.54:3128 yourAccount@your.gateway.bnl.gov
The port 8080 is chosen as an example - by rules it must be a number larger than a certain low limit. On your local machine, you would need to specify a proxy which looks like this:
localhost:8080
telnet
On Ubuntu one can install the software necessary to run the telnet service in the following manner:
sudo apt-get install xinetd telnetd
...and start the service as follows:
sudo /etc/init.d/xinetd start
pdsh
This is an advanced parallel shell designed for cluster management. It often uses ssh as the underlying protocol although there are other options as well. Configuration is defined by files residing in /etc/pdsh. For example, the file "machines" needs to contain the list of computers to be targeted by pdsh. Optionally, this is also the place for a file that can be sourced for convenience of setup, cf
# setup pdsh for cluster users export PDSH_RCMD_TYPE='ssh' export WCOLL='/etc/pdsh/machines'
This of course can be done from the command line anyway, cf
export PDSH_RCMD_TYPE=ssh
Using ssh as the underlying protocol for pdsh implies that you have set up private and public keys just like you normally would for ordinary ssh login. Once this is done, you should be able to do something like this as a basic test of your setup:
pdsh -w targetHost "ls"
If the targetHost is omitted, the command will be run against all machines listed in the "machines" file as explained above. Should a command fail on a particular machine, this will be indicated (with an error code) in the output of the command, with the name of the machine listed. Redirection of stderr with something like "2>/dev/null" included with the command you run won't work with pdsh.