• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Search

Archives for July 2021

SSSD Override Shell

July 25, 2021

If you have SSSD running and the default shell is ksh even with the default shell set to bash.

Here’s the fix to override the default shell in /etc/sssd/sssd.conf. Add override_shell.

default_shell = /bin/bash
override_shell = /bin/bash

default_shell = /bin/bash override_shell = /bin/bash

To check which shell you are using.

echo $SHELL
/bin/bash

echo $SHELL /bin/bash

Filed Under: Linux Tagged With: default, override, shell, sssd

Migrate VM to Other Network

July 20, 2021

Here’s how to move a VM to another network.

Stop the VM.

gcloud compute instances stop server-name \
--zone=us-central1-c \
--project project-id

gcloud compute instances stop server-name \ --zone=us-central1-c \ --project project-id

Migrate the VM. Use self link for network and subnetwork.

gcloud compute instances network-interfaces update server-name \
--zone=us-central1-c \
--network-interface=nic0 \
--network=your-network \
--subnetwork=your-sub-network \
--project project-id

gcloud compute instances network-interfaces update server-name \ --zone=us-central1-c \ --network-interface=nic0 \ --network=your-network \ --subnetwork=your-sub-network \ --project project-id

Start the VM.

gcloud compute instances start server-name \
--zone=us-central1-c \
--project project-id

gcloud compute instances start server-name \ --zone=us-central1-c \ --project project-id

Filed Under: Cloud Tagged With: compute, gcloud, gcp, instance, move, network, network-interface, start, stop

GCP SSH Issues

July 20, 2021

There are a few issues that prop up every once in a while with gcloud compute ssh. gcloud compute ssh creates local user at first login. The account password has a default expiration of 90 days. If unable to login, you can try logging in as a different name (even a fictitious name) e.g. superheroes, etc. something unique.

gcloud compute ssh username@servername --zone us-central1-c --project project-id --internal-ip

gcloud compute ssh username@servername --zone us-central1-c --project project-id --internal-ip

Once logged in, you can delete local users with expired passwords or perform other admin tasks.

userdel -r username

userdel -r username

You can also try to run chage to adjust the password expiration.

chage -M 180 username ​ (extends expiration from 90 to 180 days)

chage -M 180 username ​ (extends expiration from 90 to 180 days)

If you continue to have login issues, you can also delete Metadata SSH keys in both the instance and project levels.

Last resort you can use force key overwrite which will regenerate a new key and overwrite broken ssh keys.

gcloud compute ssh username@servername \
--force-key-file-overwrite \
--zone us-central1-c \
--project project-id \
--internal-ip

gcloud compute ssh username@servername \ --force-key-file-overwrite \ --zone us-central1-c \ --project project-id \ --internal-ip

Filed Under: Cloud Tagged With: compute, gcp, issues, login, ssh

Bash Aliases

July 17, 2021

Create an alias.

alias gcloud='docker run --rm -ti --volumes-from gcloud-config google/cloud-sdk:latest gcloud'

alias gcloud='docker run --rm -ti --volumes-from gcloud-config google/cloud-sdk:latest gcloud'

Remove an alias.

unalias gcloud

unalias gcloud

Filed Under: Linux Tagged With: add, alias, create, delete, remove

Terraform in a Docker Container

July 17, 2021

Run Terraform in a Docker container.

docker run --rm -it --name terraform -v ~/.aws:/root/.aws -v $(pwd):/workspace -w /workspace hashicorp/terraform:latest

docker run --rm -it --name terraform -v ~/.aws:/root/.aws -v $(pwd):/workspace -w /workspace hashicorp/terraform:latest

Create an alias.

alias terraform='docker run --rm -it --name terraform -v ~/.aws:/root/.aws -v $(pwd):/workspace -w /workspace hashicorp/terraform:latest'

alias terraform='docker run --rm -it --name terraform -v ~/.aws:/root/.aws -v $(pwd):/workspace -w /workspace hashicorp/terraform:latest'

Run the command

terraform --version
Terraform v1.0.2
on linux_amd64

terraform --version Terraform v1.0.2 on linux_amd64

Filed Under: Cloud Tagged With: container, docker, run, terraform

  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Go to page 4
  • Go to Next Page »
  • Home
  • About
  • Search

Copyright © 2023