If you're new to reading linux terminal tutorials, the $
and #
shown before commands in this documentation may be new to you. The $
simply represents a command run by a regular user (i.e. not root) in the terminal, and #
represents a command run by the root user in the terminal. Do not include the $
or #
in the command when you're running it.
Also note that when there is a command where you have to replace example text (e.g. replacing "username" with your actual username), it will often be denoted with square brackets (e.g. [username]@netsoc.com
should be replaced with eoin@netsoc.com
if your username is eoin
).
At the moment the server is only accessible via SSH, and only certain users have been given an account. This is planned to change in the future though.
To log in use the following command:
$ ssh [username]@netsoc.com
You will then be asked for your password. After entering it, you will be logged in at your home directory. Feel free to create new files here, this is your space!
If you'd like, you can change your password to something easier for you to remember with this command:
passwd
You can set up an ssh key pair, so you will not be asked for your password every time you login.
First create the key pair. You will be given the option to enter a passphrase. This passphrase deals with how the key pair is stored, so if you enter a passphrase you will have to enter it every time you try to log into the server in order to unencrypt your ssh private key (the passphrase does not have to be the same as the password to your account on the server).
(run these commands on your own computer, not on the server)
$ ssh-keygen -t rsa
When you are faced with the prompt Enter file in which to save the key (/home/[your-unix-username]/.ssh/id_rsa):
, name your key by saving it /home/[your-unix-username]/.ssh/netsoc
.
your-unix-username
refers to your username on your own computer, not the one you were assigned on Netsoc's server.
Then copy the public key to the server
$ ssh-copy-id -i ~/.ssh/netsoc.pub [username]@netsoc.com
You can now login without having to enter your password.
You're technically all set up at this point, but typing in ssh [username]@netsoc.com
every single time is a pain. There are two ways to get around this: editing your ssh config or setting up a shell alias. Setting up a shell alias is more straightfoward, but editing your ssh config is still recommended because knowing how it works is valuable knowledge (and it isn't much harder at all).
Run these commands on your own computer.
Navigate to your ~/.ssh
directory and create a config
file.
$ cd ~/.ssh
$ touch config
Open the config
file up in the text editor of your choice, and append the following lines to it:
Host netsoc
Hostname netsoc.com
User [username]
IdentityFile ~/.ssh/netsoc
Note that the Host
does not have to be called netsoc
on Line 1; you can name it whatever you want, but this makes the most sense.
You can now connect to the server by using the command
ssh netsoc
As an added benefit, you can now easily manage all of your remote servers/computers in one place.
Alternatively, you can set up an alias, which means you can simply type netsoc
or the like, instead of having to type ssh [user]@netsoc.com
.
Firstly you'll want to check which shell you're using by running which $SHELL
. It will probably be /bin/bash
although it may be another one. Check online to see where the config file for the the shell is located if you're using a different one.
For bash run
$ echo alias netsoc='ssh [user]@netsoc.com' >> ~/.bashrc
(Note that the name does not have to be netsoc, it can be anything you want, just make sure it isn't already a command!)
Then run
$ source ~/.bashrc
and the alias will be applied. Now you can just type netsoc
to log in!