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


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


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.


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

sudo visudo

# add the following line, replace 'username' with your login:


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

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.

Leave a Reply

Your email address will not be published.