Work log from Mac to VPS connecting with SSH. It's not a big task, but I'll forget it soon, so make a note for myself
Add a server in the Conoha Control Panel.
This time, specify application: LAMP
.
At the moment it seems to be CentOS 8.
Check the IP address from the details screen of the added server, and log in as the root user.
>>> ssh [email protected] -p 22
# adduser tukanpo
# passwd tukanpo
# gpasswd -a tukanpo wheel
[Addition] Later added to the apache group
# sudo visudo
If the second line is commented out, uncomment it
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
Log out of VPS
# exit
Login as a working user
>>> ssh [email protected] -p 22
Create a .ssh directory directly under the user's working directory
$ mkdir .ssh
$ chmod 700 .ssh
Log out and switch to client again
Create .ssh directory if not yet created
>>> cd ~
>>> mkdir .ssh
>>> chmod 700 .ssh
>>> cd .ssh
Generate a key (unnecessary if it already exists and can be reused)
>>> ssh-keygen -t rsa -b 2048
Copy the public key to authorized_keys on the server side
>>> scp id_rsa.pub [email protected]:~/.ssh/authorized_keys
Edit the config file in the .ssh directory (create it if it doesn't exist)
>>> vi config
Add the following
Host tukanpo.net
HostName xxx.xxx.xxx.xxx
User tukanpo
Port 22
IdentityFile ~/.ssh/id_rsa
Connect to VPS with host name
>>> ssh tukanpo.net
end
Recommended Posts