Actually I'm far from home and changed SSH access to my home server:
It works as expected, but when I back home I want to access it from local LAN with interactive console, as root at default port (22). To do that I thought to create another SSHd service and called it sshd_local, thats what I've done:
The configuration file /etc/ssh/sshd_local_config is the default one, except I enabled root access.
The /etc/rc.d/sshd_local file is modified as follow
The content of /usr/sbin/sshd_local
I started the new service with the command
and it starts, but no pid file was created in /var/run/, so executing
says the service is down (not started) but it's present in process list and it works, i.e. I can access locally as root. Also the remote sshd sevice works.
What is wrong with my configuration? Thanks in advance for your replies.
- Changed default SSH port
- Removed login as root
- Created public/private RSA keys and changed login mode (no interactive console login, keys only)
It works as expected, but when I back home I want to access it from local LAN with interactive console, as root at default port (22). To do that I thought to create another SSHd service and called it sshd_local, thats what I've done:
- Duplicated /etc/ssh/sshd_config in /etc/ssh/sshd_local_config
- Duplicated /etc/rc.d/sshd in /etc/rc.d/sshd_local
- Added sshd_local_enable="YES" in /etc/rc.conf
- Created the shell script /usr/sbin/sshd_local that starts sshd with custom parameters
The configuration file /etc/ssh/sshd_local_config is the default one, except I enabled root access.
The /etc/rc.d/sshd_local file is modified as follow
Code:
[B]/etc/rc.d/sshd[/B] | [B]/etc/rc.d/sshd_local[/B]
-----------------------------------+-----------------------------------
# PROVIDE: sshd | [color="DarkOrange"]# PROVIDE: sshd_local[/color]
# REQUIRE: LOGIN cleanvar | # REQUIRE: LOGIN cleanvar
# KEYWORD: shutdown | # KEYWORD: shutdown
|
. /etc/rc.subr | . /etc/rc.subr
|
name="sshd" | [color="darkorange"]name="sshd_local"[/color]
rcvar=`set_rcvar` | rcvar=`set_rcvar`
command="/usr/sbin/${name}" | command="/usr/sbin/${name}"
keygen_cmd="sshd_keygen" | keygen_cmd="sshd_keygen"
start_precmd="sshd_precmd" | start_precmd="sshd_precmd"
pidfile="/var/run/${name}.pid" | pidfile="/var/run/${name}.pid"
extra_commands="keygen reload" | extra_commands="keygen reload"
The content of /usr/sbin/sshd_local
Code:
#! /bin/sh
/usr/sbin/sshd -f /etc/ssh/sshd_local_config $*
I started the new service with the command
# service sshd_local start
and it starts, but no pid file was created in /var/run/, so executing
# service sshd_local status
says the service is down (not started) but it's present in process list and it works, i.e. I can access locally as root. Also the remote sshd sevice works.
What is wrong with my configuration? Thanks in advance for your replies.