I am able to connect to my instance using the normal SSH button and gcloud command. These two connection methods created @<myusername> and @<myusername_gmail_com> user accounts respectively
The problem is I don't know the password for either of these users.
This became apparent when I
sudo adduser git
sudo su git
created and switched to a new user to setup git access, I know the password for this user because I created it like normal
now switching back to the default sudo user
sudo su <myusername>
asks for a password
I tried my <Google account password>, "", "admin" — and then gave up.
At no point did I define a password for this account when it was created by gcloud.
So after switching to the git user the only way I was able to switch back to default sudo user was to kill the session and restart it.
CodePudding user response:
- You can change the passport by first elevating to root user:
sudo su -
- Then change the password for the user in question:
passwd mysername
CodePudding user response:
If you mean you want to know the root
password for your SSH to your Ubuntu OS, there is no password set for it by default, unless it was a custom set up, as discussed by @John Hanely. Also, by default, compute engine service account will be assigned.
Be reminded that you should add your newly created account to sudoers
if you want your account to have a root privileged.
You can add user in sudoers
by accessing:
- Go to
/etc
, and find thesudoers
file
cd /etc
- Access
sudoers
file, usingvim
or a text editor available to your system.
vim sudoers
Once accessed you can now add your user, there are already instructions indicated on how you can add your user.
After adding your user, save and exit to your text editor.
For vim
:
wq!
Note: each text editor have different on how to exit.