In this exercise you will learn how to login and run commands on our infrastructure.
As mentioned in the lecture, you absolutely need a terminal emulator:
optionally you may want:
sftp://tcopt2.chem.uzh.ch
as the address in your file browser and you should be able to browse your home directory after logging invim
, nano
or emacs
via SSH. Please note: It is important that your editor supports Unix line endings. If in doubt, use one of the mentioned editors on the server, or an advanced plain text editor like Atom (plus the line-ending-selector-unix plugin) or Notepad++ on your local machine.ssh -X studentXX@tcopt2.chem.uzh.ch
ssh -X studentXX@tcopt2.chem.uzh.ch
ssh studentXY@tcopt2.chem.uzh.ch
First configure Putty (only required on the first run) as follows:
tcopt2.chem.uzh.ch
SSH
tcopt2
as the name of the session below Saved Sessions and save the settings a first timeConnection > SSH > X11
from the Category
list and enable the option Enable X11 Forwarding
Session
from the Category
list and click Save
againThen continue as follows to login:
tcopt2
to start the connection$ passwd
To avoid having to type the password every time you log in (and to increase the security), a public-private key pair can be used for authentication instead.
First generate a key-pair on your local machine by running the following in a terminal/shell:
$ ssh-keygen
and accept the defaults proposed and do no set a password.
Upload the public key from your local machine to tcopt2:
$ scp ~/.ssh/id_rsa.pub studentXX@tcopt2.chem.uzh.ch:~/
Now login to tcopt2.chem.uzh.ch
and move the uploaded public key to the right place and set the access permissions correct:
$ mkdir -p .ssh $ chmod 0700 .ssh $ mv id_rsa.pub .ssh/authorized_keys
When connecting to the server from your local machine now, use:
$ ssh -i ~/.ssh/id_rsa studentXX@tcopt2.chem.uzh.ch
First login to the server as above and leave the terminal window open.
Then generate a key-pair on your local machine as follows:
condensed_matter.ppk
$ mkdir -p .ssh $ chmod 0700 .ssh $ nano -w .ssh/authorized_keys
CTRL+X
, press Y
to save the file and confirm the name by pressing ENTER
exit
to close the connectionReconfigure PuTTY to use the generate key:
tcopt2
and press Loadcondensed_matter.ppk
you generated earlierThe following instructions apply to OSX and Linux.
On your local machine add the following part to the file .ssh/config
in your home directory:
Host tcopt2 HostName tcopt2.chem.uzh.ch User studentXX
after which you will be able to connect to tcopt2
simply by using
$ ssh tcopt2
If you have setup key-based authentication as shown above, augment the entry to the following instead, to always use key-based authentication without having to specify -i ~/.ssh/id_rsa
manually:
Host tcopt2 HostName tcopt2.chem.uzh.ch User studentXX IdentityFile ~/.ssh/id_rsa IdentitiesOnly yes PreferredAuthentications publickey