Login to your machine
Once you created an instance, you should be able to login via ssh.
You can see how to login and the machine ip in the detail page.
Then open your commandline tool and type…
ssh root@xxx.xxx.xxx.xxx
Replace xxx.xxx.xxx.xxx
to your ip address, then enter your password.
Create a new user
Once, you logged in successfully, we need to create a new user to replace root for security reason.
To create a new user can be simple just type…
adduser USERNAME
Replace USERNAME
to whatever you want.
Then follow the instruction to fill the information or you can just skip it.
Give sudo privilege to your user
After the user created, you need to give sudo right to the user, so the user can perform administrative tasks.
To assign the privilege
usermod -aG sudo USERNAME
Then check if the change works
groups USERNAME
Replace USERNAME
to the user that you just created.
Login again with new user account
Before, we were using ssh root@xxx.xxx.xxx.xxx
to login, but now you can use ssh USERNAME@xxx.xxx.xxx.xxx
to login to see if everything works properly.
搶先發佈留言