Configure System Services

From gr0x0rd
Jump to navigation Jump to search

Installing Gentoo - Configure System Services

Now that we've installed all of our system utilities, we need to configure them to start with the system.



Optional - Change your ssh port

The default port for ssh connections is 22. Much like with FTP servers configured to use the default port (21), people program bots to find an ssh server listening on the default port and then hammer it, using a password dictionary, to try to guess the root password. Changing the port to something other than the default is a very easy way to deter 99% of such attacks.

The ssh port setting is stored in the file /etc/ssh/sshd_config. Find the line containing the directive Port, uncomment it, and replace yourport in the example below with your desired port.

# nano -w /etc/ssh/sshd_config

file: /etc/sshd/sshd_config

... 
Port yourport
...

Let's take a moment to configure our networking options. This will improve boot time and reduce the time it takes for the network interface to time out.

# nano -w /etc/conf.d/net

file: /etc/conf.d/net

...
modules=( "dhcpcd" )
modules_eth0=( "ifconfig" )
config_eth0=( "dhcp" )
dhcpcd_eth0="-t 5"

Start networking with the system.

# ln -s /etc/init.d/net.lo /etc/init.d/net.eth0
# rc-update add net.eth0 default

Enable numlock at startup.

# rc-update add numlock default

Start the ssh daemon, so you can connect remotely to your computer.

# rc-update add sshd default

Start the system logger, so you can view system logs for security and troubleshooting purposes.

#  rc-update add syslog-ng default

Start the cron deamon, so scheduled tasks are run when invoked.

# rc-update add vixie-cron default

Start the ntp daemon, ensuring your system time remains in sync.

# rc-update add ntpd default

Optional: RAID

If you used RAID, you'll also need to emerge mdadm and add it to the system boot level.

emerge -av mdadm
rc-update add mdadm boot

To set up notifications for RAID in the case of failure, you'll need to use ssmtp. If it hasn't already been emerged as a dependency for the above packages,

emerge -av ssmtp

Edit the configuration file

nano -w /etc/ssmtp/ssmtp.conf 

Set the proper mailhub directive.

mailhub=<yourISPsmtpserver>

Set mdadm to send you an email if a disk fails.

nano -w /etc/mdadm.conf 

Set the directive

MAILADDR youremail@domain.ext

Your system services are now scheduled to start when the system boots. The next step is to Configure the Kernel.