Where to find sshd logs on macOS sierra

I want to install the Pseudo-Distributed HBase environment on my Mac OS Sierra (10.12.4), and it requires the installation of ssh and can register with ssh localhostno password. But sometimes I came across an error when I use sshto login. First of all, this is a background question, and the actual question is where can I find debug logs sshdso that I can know why logging is no longer possible?

As I know, Mac OS has already installed sshdand is used launchdto manage it, and I know one way to output debug logs sshd -E /var/log/sshd.log, but when I looked at the configuration /etc/ssh/sshd_config, there are two lines:

#SyslogFacility AUTH
#LogLevel INFO

I assume that these two lines are used for debug mode config, then I uninstalled #before them and installed LogLevelin DEBUG3and then restarted sshd:

$ launchctl unload -w /System/Library/LaunchDaemons/ssh.plist
$ launchctl load -w /System/Library/LaunchDaemons/ssh.plist

And then I set the log path to /etc/syslog.conf:

auth.*<tab>/var/log/sshd.log

<tab> here means a tab character and reloads the configuration:

$ killall -HUP syslogd

But the sshd.logfile cannot be found in the folder /var/logat runtime ssh localhost. I also tried setting /etc/asl.log:

> /var/log/sshd.log format=raw
? [= Facility auth] file sshd.log

And the result was the same, can someone help me?

+6
source share
6 answers

ssh, , , sshd . /System/Library/LaunchDaemons/ssh.plist -E <log file location> (,/tmp/sshd.log). /etc/ssh/sshd_config, LogLevel. .

MacOS, , , - , .

+3

cp/System/Library/LaunchDaemons/ssh.plist/Library/LaunchDaemons/ssh.plist

vi/Library/LaunchDaemons/ssh.plist

-E,

 <array>
                    <string>/usr/sbin/sshd</string>
                    <string>-i</string>
                    <string>-E</string>
                    <string>/var/log/system.log</string> 
 </array>

, , sshd, sshd /var/log/system.log

launchctl unload/System/Library/LaunchDaemons/ssh.plist && launchctl load -w/Library/LaunchDaemons/ssh.plist

+3

/var/log/system.log. , "sshd":

cat /var/log/system.log | grep sshd
+2

sshd

/var/log/system.log

Apr 26 19:00:11 mac-de-mamie com.apple.xpc.launchd[1] (com.openssh.sshd.7AAF2A76-3475-4D2A-9EEC-B9624143F2C2[535]): Service exited with abnormal code: 1

. , . LogLevel VERBOSE LogLevel DEBUG3 sshd_config .

sshd_config: " DEBUG ".

, sshd launchctl, " ", " ".

: ...

, OUTSIDE/etc/ssh/sshd_config ( , ).

, Mac OS X Unix: Apple , , .

0

Apple , macOS 10.12 :

:

iOS 10.0 , macOS 10.12 , tvOS 10.0 watchOS 3.0 ASL โ€‹โ€‹(Apple System Logger) API Syslog. , , /etc/system.log. , .

, - " ", , SOL:/

0

Apple, , .

# log config --mode "level:debug" --subsystem com.openssh.sshd
# log  stream --level debug  2>&1 | tee /tmp/logs.out

$ ssh localhost
$ exit

^C (interrupt)
# grep sshd /tmp/logs.out
2019-01-11 08:53:38.991639-0500 0x17faa85  Debug       0x0                  37284  sshd: (libsystem_network.dylib) sa_dst_compare_internal <private>@0 < <private>@0
2019-01-11 08:53:38.992451-0500 0xb47b5b   Debug       0x0                  57066  socketfilterfw: (Security) [com.apple.securityd:unixio] open(/usr/sbin/sshd,0x0,0x1b6) = 12
...
...

In superuser window, restore sshd logging to default

# log config --mode "level:default" --subsystem com.openssh.sshd
0
source

Source: https://habr.com/ru/post/1674709/


All Articles