chroot 사용자에 대한 로깅을 활성화하려고 합니다.
뭔가를했을 수도 있습니다. 오류로 인해 ls -l
대부분의 /var/log
로그 파일 크기가 0인 것으로 나타났습니다. 그것을 고치려고 노력하십시오이 답변
# systemctl restart systemd-journald.socket
# systemctl start rsyslogd
Failed to start rsyslogd.service: Unit rsyslogd.service not found.
# logger -s "hellow"
logger: socket /dev/log: No such file or directory
# sudo rsyslogd -N6 | head -10
sudo: unable to resolve host iZ26v45oj3yjtmZ
rsyslogd: version 8.16.0, config validation run (level 6), master config /etc/rsyslog.conf
rsyslogd: command 'KLogPermitNonKernelFacility' is currently not permitted - did you already set it via a RainerScript command (v6+ config)? [v8.16.0 try http://www.rsyslog.com/e/2222 ]
# ls /dev/log
ls: cannot access '/dev/log': No such file or directory
syslogd가 실행 중인지 확인하세요.
#lsof -f -p 5379
syslogd 5379 root 16w REG 253,1 0 1844521 /var/log/news/news.err
syslogd 5379 root 17w REG 253,1 0 1844536 /var/log/news/news.notice
syslogd 5379 root 18w REG 253,1 3282 1580873 /var/log/debug.1 (deleted)
syslogd 5379 root 19w REG 253,1 110492 1580898 /var/log/messages.1 (deleted)
syslogd 5379 root 20u FIFO 0,6 0t0 423 /dev/xconsole
syslogd 5379 root 21u unix 0xffff880138be9400 0t0 212524 /dev/log type=DGRAM
/etc/rsyslog.conf 파일
#################
#### MODULES ####
#################
module(load="imuxsock") # provides support for local system logging
module(load="imklog") # provides kernel logging support
#module(load="immark") # provides --MARK-- message capability
# provides UDP syslog reception
#module(load="imudp")
#input(type="imudp" port="514")
# provides TCP syslog reception
#module(load="imtcp")
#input(type="imtcp" port="514")
# Enable non-kernel facility klog messages
$KLogPermitNonKernelFacility on
###########################
#### GLOBAL DIRECTIVES ####
###########################
#
# Use traditional timestamp format.
# To enable high precision timestamps, comment out the following line.
#
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
# Filter duplicated messages
$RepeatedMsgReduction on
#
# Set the default permissions for all log files.
#
$FileOwner syslog
$FileGroup adm
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022
$PrivDropToUser syslog
$PrivDropToGroup syslog
#
# Where to place spool and state files
#
$WorkDirectory /var/spool/rsyslog
#
# Include all config files in /etc/rsyslog.d/
#
$IncludeConfig /etc/rsyslog.d/*.conf
/etc/syslog.conf 파일
# /etc/syslog.conf Configuration file for inetutils-syslogd.
#
# For more information see syslog.conf(5) manpage.
#
# First some standard logfiles. Log by facility.
#
auth,authpriv.* /var/log/auth.log
*.*;auth,authpriv.none -/var/log/syslog
#cron.* /var/log/cron.log
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
lpr.* -/var/log/lpr.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log
uucp.* /var/log/uucp.log
#
# Logging for the mail system. Split it up so that
# it is easy to write scripts to parse these files.
#
mail.info -/var/log/mail.info
mail.warn -/var/log/mail.warn
mail.err /var/log/mail.err
# Logging for INN news system
#
news.crit /var/log/news/news.crit
news.err /var/log/news/news.err
news.notice -/var/log/news/news.notice
#
# Some `catch-all' logfiles.
#
*.=debug;\
auth,authpriv.none;\
news.none;mail.none -/var/log/debug
*.=info;*.=notice;*.=warn;\
auth,authpriv.none;\
cron,daemon.none;\
mail,news.none -/var/log/messages
#
# Emergencies are sent to everybody logged in.
#
*.emerg *
#
# I like to have messages displayed on the console, but only on a virtual
# console I usually leave idle.
#
#daemon,mail.*;\
# news.=crit;news.=err;news.=notice;\
# *.=debug;*.=info;\
# *.=notice;*.=warn /dev/tty8
# The named pipe /dev/xconsole is for the `xconsole' utility. To use it,
# you must invoke `xconsole' with the `-file' option:
#
# $ xconsole -file /dev/xconsole [...]
#
# NOTE: adjust the list below, or you'll go crazy if you have a reasonably
# busy site..
#
daemon.*;mail.*;\
news.crit;news.err;news.notice;\
*.=debug;*.=info;\
*.=notice;*.=warn |/dev/xconsole
여기서의 문제는 다음과 같습니다. 1.
rsyslogd.service를 시작할 수 없습니다.
2.
ls: '/dev/log'에 접근할 수 없습니다: 해당 파일이나 디렉터리가 없습니다
ls -l /var/log
대부분의 로그 파일 크기는 0입니다.
답변1
chroot 루트에 상대적인 /dev/log가 필요하기 때문에 chroot에 로그인할 수 없습니다. (이것은 알려진 "기능"입니다.)
뒤로 rsyslog
, 이와 유사한 구성을 추가합니다.
/etc/rsyslogd.conf
$AddUnixListenSocket /chroots/user1/dev/log
재부팅 rsyslog
(chroot 외부)