PROJECTS NOTES HOME

Login to gcp server with username and password

After you have logged into gcp with ssh you can do these steps.

This will allow you to login to your gcp machine from anywhere on the Internet WITHOUT an ssh key, but with username and password.

This method is less secure, but more convenient I guess.

sudo su -
vim /etc/ssh/sshd_config
# PasswordAuthentication change to yes, save file
service sshd restart
adduser username

Try to login with username and password now over putty.

Logout, login with your username and then do

sudo visudo

# Locate these lines
# User privilege specification
root    ALL=(ALL:ALL) ALL
# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# then add this line to make your user be able to login as root

# Allow the "inst" user to execute any command as root
username    ALL=(ALL:ALL) ALL

Save and close the file.

Try to login as the user and try to login as root.

You can now even remove the public key from GCP. The user will work.