Aliyun

ssh root@ip [-p 22]
 
adduser user
usermod -aG sudo user
 
# Log in with the created user
ssh user@ip

Establish passwordless login, if the directory or file doesn’t exist, create it.

~/.ssh/config
Host serverAlias
	Hostname ip
	User user

Generate a key if not available and copy it to the server.

If already present, copy directly.

# Generating a key can be done with default settings
ssh-keygen
ssh-copy-id serverAlias

Now, logging in is as simple as using the specific alias with serverAlias.

ssh serverAlias

AWS

chmod 400 xx.pem
ssh -i "xx.pem" ubuntu@ip

To enable password login.

# Set a password for the default user
sudo passwd ubuntu
 
sudo vi /etc/ssh/sshd_config
# Change no to yes
PasswordAuthentication yes
 
# Save, exit and restart the service
sudo service sshd restart

Then, log in with sudo ubuntu@ip (or configure passwordless login similar to the Alibaba Cloud instructions above).