[LINUX] I tried adding VPS to ConoHa ~ SSH connection

Also serves as a memorandum

What to do this time

--VPS installed on ConoHa --Create user --Ssh key creation, client side settings --Ssh connection

VPS installed on ConoHa

First, install the VPS. If you do not have a ConoHa account, please do so first. Log in to the control panel and select:

--Select CentOS (8.0) as the OS --Select a plan --Enter root password and name tag --The optional SSH Key is "not used"

Choose a plan that meets your requirements. If there is no problem, press Add and VPS will be installed. Image from Gyazo

Make a note of the IP address when the installation is complete. Used in matters. Image from Gyazo

Create user

Log in to the server using the IP address and password you wrote down in the previous section.

$ ssh [email protected] -p 22
#password input
[[email protected] ~]# 

Once you can log in to the server, create a user.

$ adduser hogeuser           #User created
$ passwd hogeuser            #Set a password for the created user
$ gpasswd -a hogeuser wheel  #Add to wheel group
$ su hogeuser                #Login confirmation

Ssh key creation, client side settings

Once the user has been created, allow the client to make an SSH connection.

Edit sshd_config

$ sudo vim /etc/ssh/sshd_config 
RSAAuthentication yes                         #add to
PubkeyAuthentication yes                      #Remove if commented out
AuthorizedKeysFile      .ssh/authorized_keys  #Remove if commented out

After setting, restart the service.

$ sudo service sshd restart

Creating an SSH key

Create it on the server and set it on the client.

Server side

#First, create a directory to install the SSH key
$ cd ~
$ mkdir .ssh
$ chmod 700 .ssh
$ cd .ssh

#Creating an SSH key
$ ssh-keygen -t rsa -b 4096
Enter file in which to save the key:  #Private key name (optional)
Enter passphrase:                     #Passphrase
Enter same passphrase again:          #Confirm passphrase

#Rename the created public key
$ mv id_rsa.pub authorized_keys
$ chmod 600 authorized_keys
$ cat id_rsa  #Make a copy of the contents of the private key

Client side

#Create a private key
$ cd ~/.ssh
$ vim id_rsa  #Paste the contents of the private key copied on the server
$ chmod 600 id_rsa

In addition, set the connection information in config.

~/.ssh/config


conoha
  Host xxx.xxx.xxx.xxx
  User hogeuser
  Port 22
  IdentityFile ~/.ssh/id_rsa

SSH connection

$ ssh conoha
Enter passphrase for key '/Users/xxxxx/.ssh/conoha': #Enter passphrase
[hogeuser@xxx-xxx-xxx-xxx ~]$                        #Successful connection

Recommended Posts

I tried adding VPS to ConoHa ~ SSH connection
I tried adding post-increment to CPython Implementation
I tried to debug.
I tried to paste
I tried adding post-increment to CPython Extra edition
I tried adding post-increment to CPython. Overview and summary
I tried adding system calls and scheduler to Linux
What I did to ssh to the VPS Ubuntu environment
I tried to learn PredNet
I tried to organize SVM.
I tried to implement PCANet
I tried to reintroduce Linux
I tried to introduce Pylint
I tried to summarize SparseMatrix
I tried to touch jupyter
I tried to implement StarGAN (1)
I tried adding post-increment to CPython. List of all changes
I tried to implement Deep VQE
I tried to create Quip API
I tried to touch Python (installation)
I tried to implement adversarial validation
I tried to explain Pytorch dataset
I tried Watson Speech to Text
I tried to touch Tesla's API
I tried to implement hierarchical clustering
I tried to organize about MCMC.
I tried to implement Realness GAN
I tried to move the ball
I tried to estimate the interval.
I tried to create a linebot (implementation)
I tried to summarize Python exception handling
I tried to implement PLSA in Python
I tried using Azure Speech to Text.
I tried to create a linebot (preparation)
I tried to visualize AutoEncoder with TensorFlow
I tried to recognize the wake word
I tried to get started with Hy
I tried to implement PLSA in Python 2
Python3 standard input I tried to summarize
I tried to classify text using TensorFlow
I tried to summarize the graphical modeling.
I tried to implement ADALINE in Python
I tried to let optuna solve Sudoku
I tried to estimate the pi stochastically
I tried to touch the COTOHA API
I tried to implement PPO in Python
I tried to implement CVAE with PyTorch
I tried to make a Web API
I tried to solve TSP with QAOA
[Python] I tried to calculate TF-IDF steadily
I tried to touch Python (basic syntax)
I tried my best to return to Lasso
I tried to summarize Ansible modules-Linux edition
I tried to predict Covid-19 using Darts
When I tried to connect with SSH, I got a warning about free space.
I tried to predict next year with AI
I tried to build a super-resolution method / ESPCN
I tried to use lightGBM, xgboost with Boruta
I tried to learn logical operations with TF Learn
I tried to move GAN (mnist) with keras
I tried to build a super-resolution method / SRCNN ①