The codelab example for gcloud translate lists a number of commands under the Authenticate API requests section. Which of these are persistent and which must be executes per session? I'd think once the key file is exported, that would be it. But if I try to start a fresh session and just run the code in step 7 or 8, I get an "assertion error."
Commands ran in step 4 are not persistent except for the part where key.json is created. Yes you are correct that exporting the key file will authenticate your requests.
You got the "assertion error" because you did not export PROJECT_ID. You will also get an "authentication error" if you did not also export GOOGLE_APPLICATION_CREDENTIALS.
You just need to export PROJECT_ID and GOOGLE_APPLICATION_CREDENTIALS at least once when a new session is opened prior to running the code in step 7 or 8.
export PROJECT_ID=$(gcloud config get-value core/project)
export GOOGLE_APPLICATION_CREDENTIALS=~/key.json
Related
I am trying to change use a different password on mini. I followed the guide. First time around executed it via sudo (since the guide uses /data folder) and then cleaned everything up (deleted /data as well as .minio dir).
Trying to set the variables...
export MINIO_ROOT_USER=otheruser
export MINIO_ROOT_PASSWORD=otherpass
./minio server /home/debian/data/
... only results in Invalid Credentials message. Same case for...
export MINIO_ROOT_USER=otheruser
export MINIO_ROOT_PASSWORD=otherpass
export MINIO_ROOT_USER_OLD=minioadmin
export MINIO_ROOT_PASSWORD_OLD=minioadmin
./minio server /home/debian/data/
...which also gives the same result. If i set both variables to minioadmin, it all works.
How do i change the admin account?
EDIT 1:
I also tried executing everything with sudo -E. Doing so, for both options, does nothing (throws same exception).
EDIT 2:
I have tried clean new install of whole machine. Even with that and without ever using sudo this time, it doesn't work.
#minio version go1.16
#secret key must be minimum 8 or more characters long
touch runminio.sh
vi runminio.sh:
export MINIO_ROOT_USER=otheruser
export MINIO_ROOT_PASSWORD=otherpass
nohup /usr/local/minio server /home/minio/data > /home/minio/minio.log 2>&1&
./runminio.sh
I have problem with change default user and password too
I try to
export MINIO_ROOT_USER=aaa
export MINIO_ROOT_PASSWORD=bbb
and run
./minio server /mnt/disks/disk2
finally, I change user to root
and export env again and run the server again
I can use new user and password with user aaa and password bbb
Most likely you have not exported the variables properly or have left the old values in place (or the values you exported via sudo were not there when you started as a normal user). I assume you are following this guide: https://docs.minio.io/docs/minio-server-configuration-guide.html. One note, is that per that guide, you should be removing MINIO_ROOT_USER_OLD and export MINIO_ROOT_PASSWORD_OLD on subsequent restarts of the server. This works fine for me following the steps from the doc.
On my linux server, I have a 'load_app' user account. My plan was to write a generic shell script to load data into bigquery using bq tool. gcloud is installed and I have multiple configurations in my environment. These configurations point to different service and user accounts for different projects. I am trying to set it up such that I can run multiple executions of this script at the same time for different configurations.
I tried setting CLOUDSDK_ACTIVE_CONFIG_NAME= in my script, the config-name value is being passed to the script. This setting should switch the active configuration, however, I am getting the following error :
ERROR: (bq) There was a problem refreshing your current auth tokens: invalid_grant: Bad Request
I am trying to authenticate gcloud using json key and even doing everything as per docs it requires for password when I run gcloud compute ssh root#production
Here is snapshot of steps I performed.
1. Authorizing access to Google Cloud Platform with a service account
tahir#NX00510:~/www/helloworld$ gcloud auth activate-service-account 1055703200677-compute#developer.gserviceaccount.com --key-file=gcloud_key.json
Activated service account credentials for: [1055703200677-compute#developer.gserviceaccount.com]
2. Initializing the gcloud
tahir#NX00510:~/www/helloworld$ gcloud init
Welcome! This command will take you through the configuration of gcloud.
Settings from your current configuration [default] are:
compute:
region: us-central1
zone: us-central1-b
core:
account: 1055703200677-compute#developer.gserviceaccount.com
disable_usage_reporting: 'True'
project: concise-hello-122320
Pick configuration to use:
[1] Re-initialize this configuration [default] with new settings
[2] Create a new configuration
Please enter your numeric choice: 1
Your current configuration has been set to: [default]
You can skip diagnostics next time by using the following flag:
gcloud init --skip-diagnostics
Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.
Reachability Check passed.
Network diagnostic passed (1/1 checks passed).
Choose the account you would like to use to perform operations for
this configuration:
[1] 1055703200677-compute#developer.gserviceaccount.com
[2] Log in with a new account
Please enter your numeric choice: 1
You are logged in as: [1055703200677-compute#developer.gserviceaccount.com].
API [cloudresourcemanager.googleapis.com] not enabled on project
[1055703200677]. Would you like to enable and retry (this will take a
few minutes)? (y/N)? N
WARNING: Listing available projects failed: PERMISSION_DENIED: Cloud Resource Manager API has not been used in project 1055703200677 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudresourcemanager.googleapis.com/overview?project=1055703200677 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
- '#type': type.googleapis.com/google.rpc.Help
links:
- description: Google developers console API activation
url: https://console.developers.google.com/apis/api/cloudresourcemanager.googleapis.com/overview?project=1055703200677
Enter project id you would like to use: concise-hello-122320
Your current project has been set to: [concise-hello-122320].
Do you want to configure a default Compute Region and Zone? (Y/n)? n
Your Google Cloud SDK is configured and ready to use!
* Commands that require authentication will use 1055703200677-compute#developer.gserviceaccount.com by default
* Commands will reference project `concise-hello-122320` by default
Run `gcloud help config` to learn how to change individual settings
This gcloud configuration is called [default]. You can create additional configurations if you work with multiple accounts and/or projects.
Run `gcloud topic configurations` to learn more.
Some things to try next:
* Run `gcloud --help` to see the Cloud Platform services you can interact with. And run `gcloud help COMMAND` to get help on any gcloud command.
* Run `gcloud topic --help` to learn about advanced features of the SDK like arg files and output formatting
3. SSHing to gcloud
tahir#NX00510:~/www/helloworld$ gcloud compute ssh root#production
No zone specified. Using zone [us-central1-b] for instance: [production].
root#compute.1487950061407628967's password:
I don't know which password should I enter here, also I believe it should not ask for password in the first place because I have used json key file for authentication.
Could you guys please help me out to fix this.
Thanks !
I am having trouble working through the Compute Engine Quickstart: Build a to-do app with a MongoDB tutorial. (edit: I am running the tutorial from within the compute engine console; i.e. https://console.cloud.google.com/compute/instances?project=&tutorial=compute_quickstart)
I SSH into the backend instance. I enter the "gcloud compute" command as copied from the tutorial. I am prompted to enter a passphrase. The following is returned:
WARNING: The public SSH key file for gcloud does not exist.
WARNING: The private SSH key file for gcloud does not exist.
WARNING: You do not have an SSH key for gcloud.
WARNING: SSH keygen will be executed to generate a key.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in
...
<< Identifying detail ommitted >>
...
**ERROR: (gcloud.compute.ssh) Could not fetch resource:
- Insufficient Permission**
I had run through this stage of the tutorial on a previous occasion with no problems.
I am working from a Windows 10 PC with the google-cloud-sdk installed. I am using google chrome. I have tried in both regular and incognito modes.
Any help or advice greatfully received!
DaveDub
It looks like the attempt to SSH is recognising the instance in your project, but the user doesn't have the required permissions to access the machine.
Have you tried running:
gcloud auth login
and completing the web-based authorization to ensure you are attempting to access the machine as the correct (authenticated) user? This process ensures the Cloud SDK you are running inherits the permissions of the user specified in the web-based authorisation. See here for more information on this.
It's also worth adding the link to the tutorial you are following to your question.
Besides the accepted answer, be sure you are in the correct gcloud project
gcloud projects list
Then
gcloud config set project <your-project>
I just ran into this for yet another reason. Google has always had poor handling of multi-user auth conflicts with their business products. Whatever you sign into a clean chrome session with 'first' gets a 'special', invisible role. I've noticed with gsuite that I get 'forced' into that first user when I try to access the admin panel, and the only way to escape is to make sure that whatever google user I use for the gsuite admin is 'first', or open an incognito window. I've seen this bug for years, can't believe it still exists.
Anyways, I ran into a similar issue. Somehow I was the wrong google user, so the link I got when copy/pasting out of 'connect with gcloud command' was implying wrong google user. Only noticed later when I just gave up and used the terminal that I was not my normal user... So, might look into that.
I am trying to open a port via ssh in my VM instance in Google Compute engine but I keep getting error messages.
Here is my command:
myname#instance-2:~$ gcloud compute firewall-rules create baasbox-console-port --allow tcp:9000 --source-range
s=0.0.0.0/0
here is the error message:
NAME NETWORK SRC_RANGES RULES SRC_TAGS TARGET_TAGS
ERROR: (gcloud.compute.firewall-rules.create) Some requests did not succeed:
- Insufficient Permission
pls what am i doing wrong?
gcloud auth login
Go to the following link in your browser:
(Cut and past the link into your browser address bar)
For me (Ubuntu 14.04) this does not return a verification code on FireFox, use Chromium. You should get a long string of characters as a verification code. Cut and past this into the terminal. I would then see this:
ERROR: There was a problem with web authentication.ERROR: (gcloud.auth.login) invalid_grant
After several tries of generating the code and pasting it, I copied the code and the trailing colon(:) then it worked
You need to do either of the following:
run gcloud auth login in your instance, or
when you create your VM, you need to give it read-write access to Google Cloud Platform APIs by adding the compute-rw scope as follows:
gcloud compute instances create $VM --scopes compute-rw [...]
See the gcloud compute instances create docs for more info.