So now, let us see, what we have to do, to set up Ubuntu 9.10 (Karmic Koala) with key authorization only (no pam auth).
First, we have to download the Ubuntu 9.10 Server image from ubuntu.com (x86 or x64 based on your hardware or virtual machine). I will not explain everything here, something included in this QnD are internet basics.
I used VirtualBox 3.1.2 on a Windows Vista (piece of garbage) to install it. I just created a new machine with Ubuntu x64 and a 10 GB fixed size (for performence) virtual harddisk file (.vdi). This will take some time…
When VirtualBox is creating the harddisk i was forced to create my ssh key using ssh keygen on another physikal Ubuntu 9.10 desktop machine.
ssh-keygen -t rsa
You will be asked were to store the key and if you want to use a passhrase (password) for this key (enter twice). I just left the directory for storing the key default and entered my own passphare.
Now its time to boot from the downloaded ISO-File and start installing Ubuntu on the virtual machine, but I will not explain every step here, just basics.
The language is some kind of what “you like to use to”. I like to use the english language because its default in the ICT and I have no problems using it. It’s important that you choose the right timezone (for several programs like postfix) so the installer will show you just the American English timezones, if you chose American English in the language setup. Just choose “other” to get the other timezones.
Partitions:
root@zeus:~# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000e0191
Device Boot Start End Blocks Id System
/dev/sda1 * 1 729 5855661 83 Linux
/dev/sda2 730 851 979965 5 Extended
/dev/sda3 852 1305 3646755 83 Linux
/dev/sda5 730 851 979933+ 82 Linux swap / Solaris
Later you have to create the system user. Please note that the password should have at least 8 caracters, otherwise Ubuntu will mark it as too weak, but you can continue with a weak password.
When you are at the point chosing packages (e.g. samba, mail etc.) you choose nothing. I think it is imperative to self-install everything you need.
If the installation of grub fails, just try it again. Maybe the device wasn’t found the first time in the device map.
Then boot wihout the mounted cd image and get the ip adress via “ifconfig” as root or “/sbin/ifconfig” as user. Please note, that if you want to be root by default installation of Ubntu, you have to get root access by using “sudo -s” and your own user password.
As root, just do the following first:
apt-get update
and
apt-get upgrade
SSH-Notice: You can use the local terminal or a ssh session by another system.
After that I imported my generated ssh key by using scp.
scp /home/USER/.ssh/id_rsa.pub USER@IPorDomainOFServer:.ssh/id_rsa.pub.client
Then you’ll be asked for the server’s user password.
Attention: Be aware of the “point” and the “double point” !
Now edit the id_rsa.pub.client to authorized_keys using the program “mv”.
At least edit the /etc/ssh/sshd_config, I will just output the edited lines here:
Port from 22 to another (no requred but recommended)
UsePAM from no to yes
PermitRootLogin from yes to no
Cheers,
ikkerus