Browsed by
Category: Linux

Using Git with Gitlab and second factor auth

Using Git with Gitlab and second factor auth

PROBLEM: After 2nd factor activation on Gitlab, username and password auth is not working anymore SOLUTION: Generate API key and use modified url Generate your API key on Gitlab You can find this option in Preferences > Access Tokens Copy this token and note you will see it only once (you have to generate a new one if the old is lost) Create new URL

So if you would like to push or clone the repo using e.g. git…

Read More Read More

Working with Git on the command line (Linux)

Working with Git on the command line (Linux)

Git basics Simple instruction how to handle git on the command line Check if Git is installed and ready

If not, you can install git using (on Ubuntu)

Set username and email Every commit is marked with username and email to identify the autor

You can check the informations using

(1) Initialize a local directory for Git If you want to include your local directory to version control, use init to tell Git what to track…

Read More Read More

Change file ownership (Linux)

Change file ownership (Linux)

PROBLEM: I cannot open some folders or use them properly. SOLUTION: Change ownership of the file. For single files

For directory

For changing owner and group

or

Duplicity backups to Backblaze B2 (Linux)

Duplicity backups to Backblaze B2 (Linux)

PROBLEM: I would like to backup files to the cloud. SOLUTION: Pick Backblaze B2 with awesome pricing. 1.0 Create Application Key Using official guide – https://help.backblaze.com/…Account-ID-and-Application-Key Backblaze has a very easy and intuitive interface, so I bet you don’t need any guide to do it 🙂 2.0 Connection String

You should substitute real keys with variables, just to make the string more flexible. E.g.:

3.0 – Duplicity 3.1 Backup Using Duplicity to Backblaze is very simple! You just need to generate…

Read More Read More

Import and Export GPG key pair (Linux)

Import and Export GPG key pair (Linux)

PROBLEM: Need to keep keys to be able restore backups later. SOLUTION: Simple export keys and save where you want to. 1.0 – Export Use gpg –list-keys to show all keys

My only key is myFavKey, so I will export this one using

And there you go! Yyou should both files export to same safe place 🙂 2.0 – Import Copy both files to server where you would like to restore files and import both keys.

And…

Read More Read More

Change root password Ubuntu (Linux)

Change root password Ubuntu (Linux)

PROBLEM: I would like to change root password on a fresh new install. SOLUTION: Simple one command! Run command below to switch to root:

Change password by typing:

And type new root password. Done!

Disable swap – Ubuntu (Linux)

Disable swap – Ubuntu (Linux)

PROBLEM: I do not need swap. SOLUTION: One command swap disable. [?] What is swap? https://www.linux.com/news/all-about-linux-swap-space Run:

And remove swap entry from fstab (the second line only!) And reboot the system.

How fast is my boot? (Linux)

How fast is my boot? (Linux)

PROBLEM: SSH is disconnecting after a short time! SOLUTION: Edit SSH server configuration and increase timeout. [?] Boot what? https://www.computerhope.com/jargon/b/boot.htm It is good to reboot the machine and run these 3 commands to understand what is happening during boot and how fast it was. This will show kernel and userspace boot start time.

OUTPUT:

Show services startup order:

And to show very detailed report run:

And now you should determine what is slowing down your boot!

SSH Timeout? (Linux)

SSH Timeout? (Linux)

PROBLEM: I would like to see how fast is boot of my machine! SOLUTION: No problem! [?] What is SSH? https://www.youtube.com/watch?v=X9jAjG3PWPo By adjusting SSH timeout we can achieve a balance between security (if you forget to close your SSH client) and irritating interruption of your work. You can adjust configure your client or server. I prefer to do this on the server, because you don’t have to do this on every client for every user. Just edit SSH deamon config…

Read More Read More