You want to have your Google Cloud Platform servers be ready for what you consider to be "regular" usage. What should you do to get a server to be ready for these four things listed below?
1. Able to SSH into it via Putty with a non-root user.
2. Able to sudo with this non-root user.
3. Files when modified in vi in "insert mode" can to receive clipboard-copied content with a right-click of a mouse.
4. The user can press the up key to see previous commands in the history of commands entered.
(These settings are typical with AWS AMIs.) How do you have a Linux server of any distribution (CentOS/RHEL/Fedora, Debian/Ubuntu, or SUSE) have these four traits before you have ever logged into it?
Use the "Startup script" in Google Cloud Platform. This script comes with precautions. Be careful when pasting it. The lines can potentially not wrap properly. Carriage returns could be introduced to make this script fail. Be very careful because this script creates a user with sudoer privileges. It also has a plaintext password in it for this user! This script is for informational purposes.
If you use Puppet for example, the facter tool will be able to retrieve the entire script below after the script below runs. This is a potential security concern!
This will create two "ChallengeResponseAuthentication yes" stanzas in most Red Hat family servers. You can manually comment one out. It will not prevent you from logging on.
1. When creating an virtual machine in Google Cloud Platform, there is a field for Startup script. You may have to click the link "Management, disks, networking, SSH keys" to see the Startup script text field. You can use this in the text field for "Startup script" if you want a user named "cooluser" with a password of "coolpassword" that can log in via SSH right from the beginning. Use the content of this attachment. It is a bash script named gcp_start_script_for_linux.txt. The extension .txt is used so it is not blocked by strict security software programs.
2. After the server is up, in the GCP web console click on the server's name. This way you can view the details. Click the "Edit" button. Scroll down to the "Custom Metadata" or search for the word "start". Click on the "X" to the right of it to eliminate the script as this picture shows (otherwise the script will run every time the server is rebooted):
Scroll down and click "Save".
3. You are done.
For future reference
The settings are permanent. You can reboot the server, and the settings will remain. This posting, via the attached script, answers these four questions:
#1 How do you get a new Linux server in GCP to allow for Putty connections with a non-root user from the beginning?
#2 How do you get new Linux servers to have a non-root user be given sudoer privileges before you log in manually to the virtual machine?
#3 How do you get Linux servers to support right-click mouse insertions of text via the vi text editor before you ever have logged into it?
#4 How can you get the Linux server to support browsing previous commands with the up arrow before you have logged into it?