• Skip to primary navigation
  • Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

login

GCP 400 Bad Request

by Ulysses · Mar 15, 2021

After logging in, I tried to run Terraform in GCP and received this error:

oauth2: cannot fetch token: 400 Bad Request

oauth2: cannot fetch token: 400 Bad Request

Here’s the fix. Login using application-default.

gcloud auth application-default login

gcloud auth application-default login

You can then Terraform.

terraform apply

terraform apply

Filed Under: Cloud Tagged With: 400, bad, fetch, gcp, login, oauth2, request, token

SCP

by Ulysses · Jan 6, 2020

SCP is similar to the CP or copy command, but it’s done via a secure network.

Here’s a CP command.

cp /dir1/filename /dir2

cp /dir1/filename /dir2

You can use SCP to copy file to another system. It requires login.

scp /dir1/filename user@server:/home/user

scp /dir1/filename user@server:/home/user

This is using SCP to copy a file from 2 remote systems.

scp user@host1:/home/user/dir1/file.txt user@host2:/home/user/dir2

scp user@host1:/home/user/dir1/file.txt user@host2:/home/user/dir2

Filed Under: Linux Tagged With: cp, ftp, login, network, scp, secure

GCP SDK Auth Login

by Ulysses · Dec 24, 2019

Here’s how to login to GCP from Google SDK.

gcloud auth login

gcloud auth login

  • Click on the URL to authenticate on your browser.
  • Login with your Google Account. Use MFA if prompted.
  • Click Allow when prompted.

You will then be taken to a page that you have successfully logged in.

Filed Under: Cloud Tagged With: account, auth, gcp, login, mfa, sdk, url

.bash_profile vs .bashrc

by Ulysses · Aug 21, 2019

.bash_profile is executed for login shells. .bashrc is executed for interactive non-login shells. When you login, .bash_profile is executed. If you are already logged in, .bashrc is executed. .bashrc is also executed when you start a new bash using /bin/bash.

Filed Under: Linux Tagged With: .bash_profile, bash, bashrc, login

SFTP Login

by Ulysses · Jul 8, 2019

How to login using SFTP on a non-standard port.

sftp -oPort=2233 username@servername

sftp -oPort=2233 username@servername

Get list of commands.

sftp help

sftp help

Filed Under: Linux Tagged With: authentication, cli, command line, different, login, port, sftp

Lastlog

by Ulysses · Mar 6, 2019

Lastlog displays the latest login information of all users in the system. You can’t view the lastlog file since it’s not an ascii file. You’ll need to run the actual command to view what’s in it. The program will spit out a list that may be longer than your terminal buffer. In that case, it’s best to pipe the output to “more” or better yet, use the “grep” command to isolate the user.

lastlog | more
lastlog | grep johndoe

lastlog | more lastlog | grep johndoe

Filed Under: Linux Tagged With: grep, info, lastlog, login, more

WordPress Custom Login Page

by Ulysses · Feb 4, 2014

We’ve all seen the default WordPress login page. It’s dull, bland, and boring. Typically, the login page is not part of the WordPress theme setup. Most theme designers don’t bother to change the login screen because it’s not really necessary. The cool thing is, it’s entirely feasible to customize the login page. This article will show you how to change your WordPress login page to something like below.

wp-login

Changing the WordPress Logo

We can replace the WordPress logo located on top of the login form by calling a WordPress hook called ‘login_enqueue_scripts.’ This hook is responsible for enqueuing items to the login page. In this example, we are assigning an image to ‘body.login div#login h1 a.’

Place the following code in your theme’s ‘functions.php’ file.

function urr_login_logo() { 
}

function urr_login_logo() { }

The ‘logo.png’ file is located in your theme’s ‘images’ folder. Why can’t I see the logo image? Believe me, it’s there. You can’t see it because I made it transparent. It would be visible if it were non-transparent. So, it’s possible to replace the WordPress logo or display nothing at all, like I just did just now, using a transparent image.

By the way, the image needs to be 80×80 pixels in size.

Adding a Background Image

How do we add a background image to the login page? Well, one thing worth noting, WordPress does not load your theme’s stylesheet when the login page is loaded. To style to the login page, we need to add our own custom stylesheet. It will be loaded when the login page is displayed.

Now, place the following code in your theme’s ‘functions.php’ file.

function urr_custom_login_css() {
echo '';
}
add_action('login_head', 'urr_custom_login_css');

function urr_custom_login_css() { echo ''; } add_action('login_head', 'urr_custom_login_css');

This code above loads a stylesheet when the login page is loaded. It’s using the ‘login_head’ hook.

Our Stylesheet

Create a file called login-style.css and place it inside our theme’s directory under the ‘css’ folder. We can now style our login page. The code below will apply a background image ‘darkwood.jpg’ to the login page. The form and its inputs are darkened, except for the submit button which remains unchanged. In addition, we also rounded the corners of the form.

body.login {
  background: #000 url('http://uly.me/wp-content/themes/minimum/images/darkwood.jpg') no-repeat fixed center;
}
 
div#login form { 
  background-color:#111;
  border-radius: 10px;
}
 
div#login form input#user_pass, div#login form input#user_login, div#login form input#rememberme {
  color: #aaa;
  background-color:#333;
  border: 1px solid #000;
  border-radius: 3px;
}
 
div#login form input#user_pass, div#login form input#user_login, div#login form input#rememberme {
  color: #aaa;
  background-color:#333;
}

body.login { background: #000 url('http://uly.me/wp-content/themes/minimum/images/darkwood.jpg') no-repeat fixed center; } div#login form { background-color:#111; border-radius: 10px; } div#login form input#user_pass, div#login form input#user_login, div#login form input#rememberme { color: #aaa; background-color:#333; border: 1px solid #000; border-radius: 3px; } div#login form input#user_pass, div#login form input#user_login, div#login form input#rememberme { color: #aaa; background-color:#333; }

Finally, upload your functions.php, login-styles.css and images files to your server. Enjoy your custom login page.

Filed Under: WP Tagged With: custom, login

Copyright © 2012–2021