Uly.me

cloud engineer

  • Home
  • About
  • Archives
Home/Archives for set

September 4, 2020

GCP Set Scopes

Here’s how to set the instance scope in GCP.

Stop the server.

gcloud compute instances stop server-name

gcloud compute instances stop server-name

Change the scopes.

gcloud alpha compute instances set-scopes server-name \
--service-account=your-service-account@gserviceaccount.com \
--scopes=logging-write,storage-rw \
--project your-project-id \
--zone=us-central1-a

gcloud alpha compute instances set-scopes server-name \ --service-account=your-service-account@gserviceaccount.com \ --scopes=logging-write,storage-rw \ --project your-project-id \ --zone=us-central1-a

Standard scopes

gcloud alpha compute instances set-scopes servername \
--service-account=your-service-account@gserviceaccount.com \
--scopes=service-management,logging-write,monitoring-write,trace,storage-rw \
--project your-project-id \
--zone=us-central1-c

gcloud alpha compute instances set-scopes servername \ --service-account=your-service-account@gserviceaccount.com \ --scopes=service-management,logging-write,monitoring-write,trace,storage-rw \ --project your-project-id \ --zone=us-central1-c

Start the server.

gcloud compute instances start server-name

gcloud compute instances start server-name

GCP Scope Documentation.

July 28, 2020

Change Default Editor

Ubuntu and Linux Mint use nano as their default editor. You’ll see it if you try to edit crontab or visudo. Now, there’s nothing wrong with nano, but I prefer using vim instead. Here’s how to change the default editor.

sudo update-alternatives --config editor

sudo update-alternatives --config editor

You’ll be prompted to change the default editor.

There are 4 choices for the alternative editor (providing /usr/bin/editor).
 
  Selection    Path                Priority   Status
------------------------------------------------------------
  0            /bin/nano            40        auto mode
  1            /bin/ed             -100       manual mode
  2            /bin/nano            40        manual mode
* 3            /usr/bin/vim.basic   30        manual mode
  4            /usr/bin/vim.tiny    15        manual mode
 
Press <enter> to keep the current choice[*], or type selection number:

There are 4 choices for the alternative editor (providing /usr/bin/editor). Selection Path Priority Status ------------------------------------------------------------ 0 /bin/nano 40 auto mode 1 /bin/ed -100 manual mode 2 /bin/nano 40 manual mode * 3 /usr/bin/vim.basic 30 manual mode 4 /usr/bin/vim.tiny 15 manual mode Press <enter> to keep the current choice[*], or type selection number:

Type 3 to choose vim basic.

June 24, 2020

Timedatectl

Here’s another way of setting your server’s timezone. See all the options under North America.

timedatectl list-timezones | grep -i America

timedatectl list-timezones | grep -i America

Set timezone.

timedatectl set-timezone America/New_York

timedatectl set-timezone America/New_York

To check.

date

date

Restart cron if needed.

systemctl restart cron.service

systemctl restart cron.service

  • 1
  • 2
  • Next Page »
  • Cloud
  • Linux
  • Git

Copyright © 2012–2021