Access your CMI account remotely

Nilava Metya
nilavam@cmi.ac.in

April, 2021

If you are using a Unix-like system, skip to the enumerated steps below.
If you are using Windows 10, you will need a client which allows you to generate a RSA key pair. Open Settings → Apps → Optional features and click on Add a feature next to the plus sign. Scroll through the list to find and select OpenSSH Client. Finally, click Install.

  1. On Unix, start your terminal.
    On Windows 10, open cmd as administrator: Click on the start button, search ``cmd'', right click on ``Command Prompt'' and select ``Run as administrator''.
  2. On Unix, execute (type and hit the return key) the code ssh-keygen -t rsa in the terminal. On Windows 10, execute the code ssh-keygen in the command prompt.
    The following (or something similar tot he following) will be displayed:
    Generating public/private rsa key pair.
    Enter file in which to save the key (~/.ssh/id_rsa):
    Hit the return key to keep the location as it is.
  3. In the next step, you'll be asked for a passphrase. Enter a passphrase and hit the return key. Note: Whle you are typing the passphrase, no character will be displayed, they will simply be input one by one; so type carefully. If required, hit the backspace multiple times to clear out the passphrase and re-enter.
    This passphrase will be required whenever you are trying to connect with the remote server through the ssh protocol. While connecting, the remote server will try to authenticate using your identity (the identity on your local computer). Even if someone else tries to connect to your CMI account through your computer, they will be unsuccessful because you'll be the only one knowing this passphrase.
    You may skip this step (which is not recommend) by simply hitting return, in which case the passphrase will not be required for establishing a connection.
  4. Congratulations! You have successfully generated an RSA key pair...if everything has gone right. The path to you your private key public key will be displayed, along with the key fingerprint and a random image. Here is a sample display in Unix terminal (something similar will be shown in Windows 10):
    Your identification has been saved in ~/.ssh/id_rsa.
    Your public key has been saved in ~/.ssh/id_rsa.pub.
    The key fingerprint is:
    05:1e:1e:c1:ac:b9:d1:1c:6a:60:ce:0f:77:6c:78:47 myname@mymac.local
    The key's randomart image is:
    +--[ RSA 2048]----+
    |       o=.       |
    |    o  o++E      |
    |   + . Ooo.      |
    |    + O B..      |
    |     = *S.       |
    |      o          |
    |                 |
    |                 |
    |                 |
    +-----------------+
Never ever share the id_rsa file with anyone. This is your (computer's) private identity.

Open your file browser and navigate to the location where your key-pair are saved. By default, the path is ~/.ssh/ on Unix, or C:\Users\<username>\.ssh\ on Windows. You will be needing the id_rsa.pub file (NOT id_rsa). If you cannot navigate to the above location, open your terminal (cmd on Windows) and execute the following commands. I shall assume that the location of the key-pair is the default one.
For Unix: cp ~/.ssh/id_rsa.pub ~/Desktop
For Windows: copy C:\Users\<username>\.ssh\id_rsa.pub C:\Users\<username>\Desktop
This will copy your public key (the component of the pair which is public) to your desktop.

Now log in to your CMI account. Compose an email to the system administrator asking them to ``kindly copy the ssh key to the appropriate location". Attach the file id_rsa.pub in this email. Send it.

Open your terminal (or cmd on Windows) and try to execute ssh <cmi_userid>@access2.cmi.ac.in. For example, I would execute ssh nilavam@access2.cmi.ac.in on the terminal. You will be asked to enter your passphrase. After you enter this correctly, you will be connected to your CMI local account.

You can now access the local computer at CMI loggined with your account, as it would have looked like when accessing offline from the computer lab, remotely from your home. The only difference is that the GUI will be missing. You may (recommended) learn to work with the linux terminal from some online resources. Here is a good place to start.

The CMI inbox (Roundcube) has a very limited capacity, and tends to get full too soon. One way is to continuous delete emails or save them in some place other than your inbox. There's another way out. You might want to forward those mails, which come to your CMI account, to some other account (like gmail) which has a considerable amount of inbox capacity. Follow the steps below. I am assuming that you do not have access to the CMI computers. Keep your terminal ready.

  1. ssh to your cmi account. For example, I'd execute ssh nilavam@access2.cmi.ac.in.
  2. Now you need to create a file named .forward which contains just the email to which you want your CMI mails to be be forwarded (nilavametya.huntik@gmail.com in my case). To do this, execute the command echo <your_complete_email> > ~/.forward. For example, I'd execute echo nilavametya.huntik@gmail.com > ~/.forward.

Congratulations! From now, any email sent to your CMI account will be redirected to the other account you provided in the file.

For sending emails from your CMI account, you still have to login to Roundcube. If you want to avoid this as well, follow the steps below. I shall assume here that you are using gmail. For other email service providers, I'm sure there must be something analogous.

  1. Login to your Gmail account.
  2. Go to Settings → Accounts and Import. Scroll down and locate Send mail as:.
  3. Click on Add another email address.
  4. You will be asked for your name and the email address that you want to add. In my case, I'd enter Nilava Metya and nilavam@cmi.ac.in respectively. If the gmail account is yours (and so is the CMI account), keep the Treat as an alias option checked. Click on the button.
  5. You may use the following settings:
    • SMTP Server: mail.cmi.ac.in
    • Port: 25
    • Username: <your_cmi_userid>@cmi.ac.in (I would fill in nilavam@cmi.ac.in)
    • Password: your_password (I would fill in … yes, you know my password)
    • Secured connection using TLS
  6. Click on Save Changes.

Now when you compose an email from your gmail account, you should see a dropdown option in the From: field, where both your gmail and cmi accounts will be mentioned.

You might want to add a filter on gmail to separate emails related to your CMI account. This helps in better management. Learn more about this here.

Create a folder called .www on your homepage on the local CMI computer (you can ssh to do that). Inside that folder, create a file called index.html. This will be the file that will be visible as your homepage. For example, https://www.cmi.ac.in/~nilavam is just the view of my index.html that I have put in the .www directory in my account. Of course, you'll have to get a little bit of understanding of HTML to create your homepage, which you can easily do using online resources, or simply go to someone's homepage and try to view source to see their index.html file (you might find a lot of other related CSS and javascript files which are used for formatting purposes, but a good webpage can be built without those). Finally, in order to edit your index.html file, you can either make edits on your local computer (at your home) and upload using the scp command, or you can edit the file online using nano or vi.