In this post I show how to configure SSH
Remember the last step in part 1?
I assigned an IP address to the virtual adapter so that I can connect via SSH to my virtual box.
Of course it can be any address you wish but it’s best to just use 10.0.0.0/8 172.16.0.0/16 192.168.0.0/24 which are the private addresses.
I will be using also a little application that will give me the option to start the VirtualBox in headless mode because, I do not need the window running while I am using SSH.
Also to SSH I will be using PUTTY (see bottom page for homepage)
Onwards.
The IP address of eth1 will be in my case
172.16.1.10
255.255.255.0
172.16.1.1
172.16.1.0
eht0 will just have an ip chosen automatically
To add/modify an entry you may need to edit the files in
/etc/sysconfig/network-scripts/
there you will have several files including ifcfg-eth0 or ifcfg-eth1. You should have both though if you followed through part 1.
Here are my settings for eth1
DEVICE=eth1
BOOTPROTO=static
BROADCAST=172.16.1.255
HWADDR=08:00:27:5C:35:58
IPADDR=172.16.1.10
NETMASK=255.255.255.0
NETWORK=172.16.1.0
ONBOOT=yes
SSH
The SSH configuration file is located:
/etc/ssh/sshd_config
just use your normal editor (nano or vi)
Things that should be changed:
Port: SSH uses port 22. I never use port 22 instead I try to use ports higher then 49152 or dynamic ports / private ports these are called.
Here are some settings which I change
Port | 50000 | listening port for sshd |
Protocol | 2 | See here a list of 2 vs 1 |
LoginGraceTime | 30 | How much time shall pass before authentication (default 2m) |
PermitRootLogin | no | Normally not needed since you can just su the commands. I commented out this. In a production environment though you should not do this. |
PermitEmptyPasswords | no | I don’t need to explain this, no ? |
MaxStartups | 4:50:10 | Limit the maximum number of unauthenticated connections that the ssh server will handle at the same time. The MaxStartups option is in the format start:rate:full. sshd will begin to refuse connections randomly at rate/100 (ie. 50% here) once there are more than start connections. This refusal probability increases linearly until full number of connections is reached, whereby all connections are refused until some open connections clear up (time out or finish). |
More on SSH and configuring here.
Next do a reload. If you do a restart and your are already connected via ssh then that connection will close.
sudo /sbin/service sshd reload
Now fire up PUTTY
Enter the IP address of ethX port # and select SSH then click Open.
That’s it.
FreeBSD Note
# ee /etc/rc.conf
add the command below into the file in order for it to be permanent
ifconfig_em0="inet 10.10.1.2 netmask 255.255.255.0"
or more concrete but not needed in the case of virtualbox > ssh
ifconfig_em0="inet 10.10.1.2 netmask 255.255.255.0 media 100baseT/UTP mediaopt full-duplex"
next restart networking
# /etc/rc.d/netif restart
Source: http://www.cyberciti.biz/faq/howto-configure-freebsd-full-half-duplex-speed/
PUTTY Download Page
No comments:
Post a Comment