Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
HOWTOs/ssh.md
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
48 lines (34 sloc)
1.2 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### SSH config file | |
It is quite useful to have a `.ssh/config` file, which may look like: | |
``` | |
Host $HOSTALIAS | |
Hostname $HOST | |
User $USER | |
# from the outside we have to go through geniux | |
ProxyJump geniux.molgen.mpg.de | |
ForwardX11 yes | |
# for jupyter | |
LocalForward $PORT $HOST:$PORT | |
``` | |
where you have to substitute the `$X` expressions | |
``` | |
$HOST with your preferred compute server, e.g. nyancat | |
$HOSTALIAS with a short name for $HOST, e.g. ny | |
$USER with your user name | |
$PORT with the port number used for jupyter, otherwise comment this line | |
``` | |
For more advanced options check out: `man ssh_config` | |
### tab-completion of hostnames | |
On the linux cluster the first 3 letters of most hostnames are unique. Therefore tab-completion works nicely after 3 letters only. | |
Put this code block in your `.bashrc`: | |
``` | |
HOST_NAMES=( $( cut -f1 -d' ' ~/.ssh/known_hosts |\ | |
tr ',' '\n' |\ | |
sort -u |\ | |
grep -e '[[:alpha:]]') | |
$( awk '{print $1}' /etc/hostconfig |\ | |
grep -v "^#" |\ | |
grep -v "^$" |\ | |
sort -u ) ) | |
complete -o default -W "${HOST_NAMES[*]}" ssh | |
``` |