SSH
stands for Secure Shell. It's a network protocol by which you can operate devices remotely over the World Wide Web. 👻 spooky 👻
You're going to need PuTTY to be able to SSH into anything.
Once PuTTY is installed, we need to create a key.
- Open PuTTYGen.
- Click
Generate
. - Wave your mouse around the little box like an idiot. PuTTYGen is using the (x, y) coords to generate a random key.
- Enter a passphrase to protect the key.
- Click
Save private key
and save your private key. - Click
Save public key
and save your public key.
Your public key will live on the server, and your private key will live on forever in our hearts RIP- I mean, live on your machine.
First, we've gotta set up the connection. We (thankfully) only have to do this once per machine.
- Open PuTTY.
- In the
Host Name
box, put[email protected]
. - Go to
Connection > SSH > Auth
, and browse for your private key file in thePrivate key file for authentication
box - Go back to
Session
tab, and enter a name for this configuration in the text box underSaved Sessions
. - Click
Save
.
Now we can actually connect to the server.
- Open PuTTY if it's not open already.
- Double-click on your save RS21 session.
2. The first time this happens you may get a warning about PuTTY never having seen that host before or something, you can click
Yes
orOkay
or whatever.
- Export your key in a format *nix machines know what to do with.
- Open PuTTYGen.
- Load your key.
- Go to
Conversions > Export OpenSSH key
. - Save the file.
- Make sure your machine knows what key to use:
mv yourkeyfilehere.openssh ~/.ssh/id_rsa
(this moves the file to the proper directory within your home directory and renames it toid_rsa
, the default key name on *nix systems).
(This should work, but I haven't tested it.)
Run ssh [email protected]
into your terminal. That's it. You're done.
You're going to need root-level access to do some things, especially when dealing with the web server side of stuff. Preface your commands with sudo
and they will be executed as root-level commands. You'll need to enter your password the first time you run a sudo
command in a session.
sudo
stands for Super User Do.
Run the list command: ls
. This will print out the files and folders within the directory you are in.
You can also run ls some/path
. Guess what that will do.
Sometimes, there are hidden files within a directory. Run ls -a
to show them.
There are two ways to create files.
touch filename.whatever
vim filename.whatever
ornano filename.whatever
oryourtexteditorhere filename.whatever
The second command will open the file in said text editor after creation.
To create a directory, run mkdir yourdirectoryname
.
To copy files, run cp path/to/file.txt path/to/destination/
To copy files, run mv path/to/file.txt path/to/destination/
To copy/move directories, run cp -R path/to/directory/ path/to/destination/
or mv -R path/to/directory/ path/to/destination/
respectively.
The -R
flag means it will recursively look through the file tree to move the entire contents of the directory.
To access the PostgreSQL database, you must be the postgres
user.
- SSH into the server.
- To switch user, run
sudo su postgres
. This will use the switch user command to log you in aspostgres
. - Run
psql
. - Have fun.*
* Required step
FTP
stands for File Transfer Protocol.
On Windows we'll need a program called Cyberduck to do our FTP stuff for us. Download and install it.
- Click
Open Connection
. - At the top, select
SFTP
. This is the Secure File Transfer Protocol. - For
Server
, enterrs21.io
- For
Username
, enter your username. Wow. - Don't enter a password, but do select your SSH key down at
SSH Private Key
. - Click
Connect
. - Drag and drop to your heart's content.
The proper destination for webapps that need to be on the portal is /var/www/rs21.io/portal/webappname/
.