Also serves as a memorandum
--VPS installed on ConoHa --Create user --Ssh key creation, client side settings --Ssh connection
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"
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
Once the user has been created, allow the client to make an SSH connection.
$ 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
Create it on the server and set it on the client.
#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
#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.
conoha Host xxx.xxx.xxx.xxx User hogeuser Port 22 IdentityFile ~/.ssh/id_rsa
$ ssh conoha Enter passphrase for key '/Users/xxxxx/.ssh/conoha': #Enter passphrase [[email protected] ~]$ #Successful connection