Session 1 Setup
A lot of moving parts
1) Create the container
- ./makeContainer <image> <name>
@ Get ssh and generating a PPK pair
Windows
Linux, Mac
- ssh-keygen
- ssh is already installed
- scp already installed
Installing the public key on your container
- http://<container name>.lan/makeMeaPPK/
- passwords and passphrases ask in class or email
- makeMeaPPK -
- vicpi@<yourcontainer> - the passphrase you
created
Logging In
- vicpi@<container name>
- Enter passphrase for your private key.
New User
- Your can create a new user with the command
- adduser
<newusername> -s /bin/bash
- If you want to log in via ssh to this new user you need to:
- edit
/etc/ssh/sshd_config and modify the line:
- AllowUsers deid
vicpi
- Create a .ssh directory in the new users home
directory with the permissions rwx------ chmod 700 .ssh to
do this.
- Create a <user>/.ssh/authorized_keys2
file with a valid public key in it. You could copy the
vicpi authorized_keys2 file. You may have to change its
ownership. chown
newuser.newuser authorized_keys2 where newuser
is the name of the user you just created.
- Security is a nuisance. Lack of security is a
bitch.
Install nano
- You can use vi if you want, it is installed.
- su
- apk add nano
Create a file called foo.test by
- nano foo.test
- type some stuff and then exit and save
and/or install mousepad and X11 forwarding
if you want to work with a GUI editor.
- On your container machine do the following
- install the mousepad editor and dependencies
- su to become root
- apk add xauth ghostscript-fonts mousepad
- Enable X11 forwarding in /etc/ssh/sshd_config on your
container by uncommenting and changing the following lines.
- X11Forwarding yes
- X11DisplayOffset 10
- X11UseLocalhost yes
- restart sshd
- exit to stop being root
- On your laptop edit /etc/ssh/ssh_config to add or uncomment
(so you don't have to enter -X for the ssh command):
Use scp to copy foo.test to your laptop or ..
The following assumes that your private and public keys are in
your .ssh directory on your laptop ...
[deid@8gig
~]$ scp deid@deid:foo.test .
foo.test
100% 20 0.0KB/s
00:00
[deid@8gig ~]$ cat foo.test
This is some stuff.
If not you need to do: scp -i <your private key file>
deid@deid:foo.test .
When we are done you should be able to:
- ssh to your machine using PPK
- scp to/from your machine/