Cannot reload/restart SSH using DA Service Monitor

wtptrs

Verified User
Joined
Jul 13, 2015
Messages
324
Whenever we try restarting or reloading ssh using the DA Service Monitor on any of our DA servers, we get the following error:

An error has occurred

Details

/etc/init.d/sshd restart >/dev/null 2>&1


The only related log entry we can find appears in errortaskq.log:

2015:07:09-14:48:04: Error reloading service sshd : uid 0 gid 0 : /etc/init.d/sshd reload >/dev/null 2>/dev/null : returned 127

Restarting ssh manually on the server works fine:

restart ssh
ssh start/running, process 20099


service ssh restart; echo $?;
ssh stop/waiting
ssh start/running, process 10057
0


Anyone have an idea what the problem could be?

Thanks.
 
Hello,

Exit code 127 means "command not found". Possible problem with $PATH or a typo.

Add

Code:
set -x

into /etc/init.d/sshd

somewhere after

Code:
### END INIT INFO

and try to restart the service in directadmin. That might give you some clues.
 
Thanks for the response, it does seem $PATH related; when adding

echo "`date`: Path vars: $PATH" >> /root/sshd_path.txt

to /etc/init.d/sshd

output when restarting in shell:

Tue Jul 14 09:12:01 CEST 2015: Path vars: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

output when restarting via DA:

Tue Jul 14 09:12:27 CEST 2015: Path vars: /usr/bin:/bin

Where can I edit the $PATH variables Directadmin is using?
 
What file can't it find? I've got the following env when executing ssh restart via Directadmin:

Code:
TERM=xterm
SSH_USE_STRONG_RNG=0
PATH=/sbin:/usr/sbin:/bin:/usr/bin
PWD=/
LANG=en_US.UTF-8
SHLVL=1
_=/bin/env

on CentOS release 6.6 (Final)


How does your /etc/init.d/sshd look like?
 
Hey Alex,

Thanks for the help. We were able to fix this issue by adding

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

to /etc/init.d/directadmin and restarting the DA service.

We are running Ubuntu 12.04 servers for DA by the way and had this issue on all of our servers.
 
Back
Top