systemd 마운트 네임스페이스를 사용하여 ntpd를 시작할 때 pid 1과 다릅니다.

systemd 마운트 네임스페이스를 사용하여 ntpd를 시작할 때 pid 1과 다릅니다.

systemd를 사용하여 ntpd를 시작할 때 ntpd pid의 마운트 네임스페이스가 pid 1과 다른 이유는 무엇입니까?

systemd를 사용하여 ntpd를 시작할 때

마운트 네임스페이스만 pid 1과 다릅니다.

ntpd mnt:[4026532696]이 표시되지만 pid 1은 mnt:[4026531840]입니다.
#ll /proc/`pidof ntpd`/ns
total 0
lrwxrwxrwx 1 root root 0 Jun  7 17:58 ipc -> ipc:[4026531839]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 mnt -> mnt:[4026532696]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 net -> net:[4026531968]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 pid -> pid:[4026531836]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 user -> user:[4026531837]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 uts -> uts:[4026531838]

#ll /proc/1/ns
total 0
lrwxrwxrwx 1 root root 0 Jun  7 17:58 ipc -> ipc:[4026531839]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 mnt -> mnt:[4026531840]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 net -> net:[4026531968]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 pid -> pid:[4026531836]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 user -> user:[4026531837]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 uts -> uts:[4026531838]

systemd를 사용하지 않고 ntpd를 시작하는 경우

systemd를 사용하지 않고 ntpd를 시작하면 ntpd pid의 마운트 네임스페이스는 pid 1의 마운트 네임스페이스와 동일합니다.

#systemctl stop ntpd

#/usr/sbin/ntpd -u ntp:ntp -g

#ll /proc/`pidof ntpd`/ns
total 0
lrwxrwxrwx 1 root root 0 Jun 20 19:46 ipc -> ipc:[4026531839]
lrwxrwxrwx 1 root root 0 Jun 20 19:46 mnt -> mnt:[4026531840]
lrwxrwxrwx 1 root root 0 Jun 20 19:46 net -> net:[4026531968]
lrwxrwxrwx 1 root root 0 Jun 20 19:46 pid -> pid:[4026531836]
lrwxrwxrwx 1 root root 0 Jun 20 19:46 user -> user:[4026531837]
lrwxrwxrwx 1 root root 0 Jun 20 19:46 uts -> uts:[4026531838]

#ll /proc/1/ns
total 0
lrwxrwxrwx 1 root root 0 Jun  7 17:58 ipc -> ipc:[4026531839]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 mnt -> mnt:[4026531840]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 net -> net:[4026531968]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 pid -> pid:[4026531836]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 user -> user:[4026531837]
lrwxrwxrwx 1 root root 0 Jun  7 17:58 uts -> uts:[4026531838]

systemd로 시작된 다른 데몬은 괜찮아 보입니다.

sshd pid는 1252입니다

#ll /proc/1252/ns/
total 0
lrwxrwxrwx 1 root root 0 Jun 20 19:52 ipc -> ipc:[4026531839]
lrwxrwxrwx 1 root root 0 Jun 20 19:52 mnt -> mnt:[4026531840]
lrwxrwxrwx 1 root root 0 Jun 20 19:52 net -> net:[4026531968]
lrwxrwxrwx 1 root root 0 Jun 20 19:52 pid -> pid:[4026531836]
lrwxrwxrwx 1 root root 0 Jun 20 19:52 user -> user:[4026531837]
lrwxrwxrwx 1 root root 0 Jun 20 19:52 uts -> uts:[4026531838]

답변1

이는 배포판마다 다르지만 이는 systemd 기능을 사용한 결과라고 생각합니다 PrivateTmp: true.

에서 언급했듯이서비스-개인/tmp부분이것Lennart Poettering의 블로그 게시물:

내부적으로 이 기능은 커널의 파일 시스템 네임스페이스를 활용합니다. 활성화되면 새 파일 시스템 네임스페이스가 열리고 대부분의 호스트 계층 구조(/tmp 제외)를 상속받습니다.

예를 들어이 버그 보고서이 옵션을 Fedora에 추가하도록 요청하세요.

관련 정보