Sunday, April 5, 2015

SSH Login Without Password

If there's one place Linux really shines, it's got to be the shell. And the ssh daemon makes it incredibly easy to securely login to a remote computer as if it was your own. You can use ssh to forward ports, as a secure proxy for web browsing, and even for running graphical applications installed on remote machines (see X11 forwarding.) And if you use ssh a lot, removing password based authentication is a serious time-saver.

The first thing you'll need to do to remove password based authentication is to generate your own ssh key on the client machine (the one connecting to the server.) You can do this with the ssh-keygen command. With your key generated, you'll now need to copy your public key to the server's authorized keys list. If you have the openssh-clients package installed, copying your key is as easy as, ssh-copy-id user@server -- where user is your username on the remote machine, and server is the remote machine's IP address or hostname.

You should now be able to login to the remote machine with ssh user@server without entering a password!

(Pro-Tip: If you want to be super-secure, you can disable password based authentication on the remote machine's ssh server by setting PasswordAuthentication to no in  /etc/ssh/sshd_config. Now only users with keys can login!)

Friday, April 3, 2015

Running OpenBox in Chrome OS


I had heard of Crouton before, but only in the context of people running Ubuntu on their Chromebooks. It turns out that Crouton can run many Debian derivatives, including Debian itself. Crouton works by configuring a target OS inside a chroot, allowing both OS's to run simultaneously and share the same kernel. As you'd guess, the overhead for running a guest OS is low. The Crouton install script also has a variety of target configurations, including Xfce, LXDE and yes, Unity.

Having a sub-$200 Chromebook and only needing to run a few Linux applications natively, I wanted to use Courton to run a light WM (Window Manager) instead of a full-fledged Desktop Environment. While an OpenBox target didn't already exist on Crouton, the core target allows for a bare-bones installation in which the user can install their own software afterwards, à la carte.

A Google intern recently wrote a feature that allows Crouton chroots to send their display to a native window in Chrome OS. With the Crouton script and my Chromebook in Developer Mode, I installed Debian Wheezy with no WM or DM by using the command sudo sh -e ~/Downloads/crouton -r wheezy -t core,xiwi -- though I'm sure I could have left core out, as the xiwi target would pull it as a dependency.


I then entered the chroot with the sudo enter-chroot command, and installed OpenBox and urxvt by issuing apt-get install openbox rxvt-unicode fonts-inconsolata to the terminal inside the chroot. After that, I chose the exit the chroot, and re-start it with sudo enter-chroot -b xinit openbox-session. I can now do Java development, run IPython Notebook, or even host a mail server.

(Note, if you're going to live with this long-term, make sure to create a proper .xinitrc file -- allowing you to leave openbox-session off of your enter-chroot command -- and read up on properly configuring OpenBox.)