Browsed by
Category: linux

Sweet Home – setup sudo, ssh and dotfiles

Sweet Home – setup sudo, ssh and dotfiles

When I build a new Linux host/Raspberry to play around, there are four basic things I always do first. No fancy automation, just quick and dirty manual labor:

  • install my favorite editor vim, make vim the default editor (optional)
  • add my ssh-key to authorized_keys for passwordless logins via SSH
  • configure sudo to avoid the password prompt when doing superuser stuff
  • clone my dotfiles git repo to setup my environment for convenient terminal usage

vim

Without vim I am lost.

# accept to enter the password for sudo once more:
sudo apt-get install vim

# make vim the default editor (optional)
sudo update-alternatives --set editor /usr/bin/vim.basic

ssh-key

I usually login with my password to accomplish the task. If there is a default password I change it.

cd ~
mkdir .ssh
touch .ssh/authorized_keys && chmod 640 .ssh/authorized_keys
# copy + paste id.pub > .ssh/authorized_keys
# I do this with vim, any editor will do ;-)
vim .ssh/authorized_keys

Make sure your ssh-key is loaded (e.g. with putty pageant) and login to verify it works.

Now I disable logins with passwords via SSH.

sudo vim /etc/ssh/sshd_config

# make sure there is a line with
PasswordAuthentication no

# restart ssh
sudo systemctl restart ssh

Do not logout. Check if everything works as expected first. This way your SSH session remains available to fix things if necessary.

sudo

On my hosts I want to use sudo without password prompts.

sudo visudo

# add the following line, replace 'username' with your login:
username ALL=(ALL) NOPASSWD: ALL

dotfiles

This is where the magic comes in 😉

Managing your dotfiles with git is quite a popular topic for Mac and Linux users. You will find a lot of resources out there. A helpful starting point is https://dotfiles.github.io/ or https://github.com/webpro/awesome-dotfiles

When I started to organize my personal dotfiles I based my repository on the work of Zach Holman.

What are dotfiles good for?

In Unix-like systems files and directories starting with a dot in its name are “hidden” and don’t show by default. That is where the name comes from. Dotfiles store per-user configuration for applications like bash, git, vim and many others.

I prefer to have a consistent configuration across my hosts for the fundamental tools I mentioned above.

Make them rock. Just clone the repo and initialize the environment:

# install git first
sudo apt-get install git

git clone https://github.com/tbaecker/dotfiles.git ~/.dotfiles
~/.dotfiles/bin/dotfiles

Log out and in again. You’re setup.

Dotfiles are a very personal thing. You tweak them the way you want. Check out the various approaches and setups and choose one that fits your expectations. You will have to take some time but once setup it will begin to pay off.

Disable dnfdragora-updater in Fedora

Disable dnfdragora-updater in Fedora

dnfdragora-updater is responsible to look for new package updates to your system. By default it is configured to do so every 180 minutes.

The problem is, it will from time to time begin to eat 100% of a cpu core for nothing and slow down the system. So, what can you do about it?

  1. do kill the process if the problem occures
  2. reconfigure dnfdragora to look less frequently (and hope this will resolve or at least mitigate the problem)
  3. disable dnfdragora-updater completely, do package updates by yourself with dnf

Read More Read More

Fedora 30, Virtualbox and libxcrypt

Fedora 30, Virtualbox and libxcrypt

It is a never ending story. New dist release, new problems with Virtualbox.

What is the current problem with a Fedora 30 guest on a Windows host and Virtualbox 6.0.8? Well, the guest additions won’t work, especially vboxadd.service refuses to start.

After asking my search engine of choice it revealed the libxcrypt to be the culprit. There are some changes mentioned at https://fedoraproject.org/wiki/Releases/30/ChangeSet and it is referenced at https://forums.virtualbox.org/viewtopic.php?f=3&t=92953.

Solution:

Install the libxcrypt-compat package and the vboxadd.service will start again, problem fixed.

Strange mouse behaviour with Fedora 28 in Virtualbox

Strange mouse behaviour with Fedora 28 in Virtualbox

I use Fedora 28 with XFCE as a virtual machine in Virtualbox 5.2.12, hosted on Windows 10.

In full screen mode this works really well.

But suddenly I had huge problems with my left mouse button. In some windows it worked, in others it didn’t and vice versa. After trying random things, it worked for some time, then stopped again. Or didn’t work at all.

The system was actually unusable any more.

It took some time until I realized this strange behaviour was caused by the latest kernel update to 4.17

As soon as it was clear I just had to use the old 4.16 kernel the next steps where easy.

Read More Read More

Configure Windows keyboard shortcuts in XFCE

Configure Windows keyboard shortcuts in XFCE

My windows manager of choice for Linux is XFCE.

While working in XFCE I realized that I got so accustomed to the Windows 10 keyboard shortcuts for tiling windows, I wanted to have the same functionality in XFCE.

And it is no problem to make that happen.

Just go to Settings -> Windows Manager -> select the Keyboard tab. Then scroll down to “Tile windows to the …”, mark the entry you want to change and click the “Edit” button. Follow the instructions.

To tile the window to the left enter: <Super(Windows key)> + <left arrow>

Create your own Debian mirror with debmirror

Create your own Debian mirror with debmirror

We will walk through these steps to get the local Debian mirror up and running:

  1. make sure you have enough space on your harddrive
  2. install debmirror, configure a cronjob to sync data
  3. make your mirror available to your clients (via apache or nfs)
  4. keep an eye on your cronjob – from time to time your script may have trouble to sync
  5. configure sources.list to use your local mirror

Read More Read More

What is “Kali Linux Light”?

What is “Kali Linux Light”?

Do you know the difference between “Kali Linux 32 bit” and “Kali Linux 32 bit Light”?

There are several ISO images to choose from when it comes to downloading Kali Linux. Most of them are quite obviously named: “Kali Linux 64 bit XFCE” – no doubt about that.

But theres is no hint or easy way to find documentation about the ingredients of this considerably smaller installation variant “light”.

Read More Read More