誤って「/etc/inittab」をシェルに貼り付けて何かを台無しにしましたか?

誤って「/etc/inittab」をシェルに貼り付けて何かを台無しにしましたか?

助けてUnixの専門家、

私たちはいくつかのシステムチェックをしていて(PuTTYを使って)シェルに入りました
# more /etc/inittab
すべてを文書に貼り付ける意図で出力をコピーしました。ところで、誤って右クリックしました。これはパテから貼り付けることを意味するので、すべてを再びシェルに貼り付けました。

私は本当に悪いことを台無しにしましたか?次回はシステムが起動しないのか気になりますか?本当に狂っていると思います。これは生産システムです。これまではすべてが正常なようです。それでも/etc/inittab同じですが、後で公開される他の内容を私がめちゃくちゃにしたのではないか心配です。

# more /etc/inittab
init:3:initdefault:
ioin::sysinit:/sbin/ioinitrc >/dev/console 2>&1
tape::sysinit:/sbin/mtinit > /dev/console 2>&1
muxi::sysinit:/sbin/dasetup   </dev/console >/dev/console 2>&1 # mux init
stty::sysinit:/sbin/stty 9600 clocal icanon echo opost onlcr ixon icrnl ignpar </dev/systty
brc1::bootwait:/sbin/bcheckrc </dev/console >/dev/console 2>&1 # fsck, etc.
link::wait:/sbin/sh -c "/sbin/rm -f /dev/syscon;                        /sbin/ln /dev/systty /dev/syscon" >/dev/console
2>&1
cprt::bootwait:/sbin/cat /etc/copyright >/dev/syscon           # legal req
sqnc::wait:/sbin/rc </dev/console >/dev/console 2>&1           # system init
#powf::powerwait:/sbin/powerfail >/dev/console 2>&1            # powerfail
cons:123456:respawn:/usr/sbin/getty console console            # system console
#ttp1:234:respawn:/usr/sbin/getty -h tty0p1 9600
#ttp2:234:respawn:/usr/sbin/getty -h tty0p2 9600
#ttp3:234:respawn:/usr/sbin/getty -h tty0p3 9600
#ttp4:234:respawn:/usr/sbin/getty -h tty0p4 9600
#ttp5:234:respawn:/usr/sbin/getty -h tty0p5 9600
ems1::bootwait:/sbin/rm -f /etc/opt/resmon/persistence/runlevel4_flag
ems2::bootwait:/sbin/cat </dev/null >/etc/opt/resmon/persistence/reboot_flag
ems3:3456:wait:/sbin/sh -c "/usr/bin/touch /etc/opt/resmon/persistence/runlevel4_flag; /usr/bin/chmod 644 /etc/opt/resmo
n/persistence/runlevel4_flag"
ems4:3456:respawn:/etc/opt/resmon/lbin/p_client
#ups::respawn:rtprio 0 /usr/lbin/ups_mond -f /etc/ups_conf
a0:3:off:/usr/sbin/getty -h ttyd2a1 1200
a1:3:off:/usr/sbin/getty -h ttyd2a2 1200
#



ペーストは次のとおりです。

# # more /etc/inittab
init:3:initdefault:
# init:3:initdefault:
stty::sysinit:/sbin/stty 9600 clocal icanon echo opost onlcr ixon icrnl ignpar </dev/systty
brc1::bootwait:/sbin/bcheckrc </dev/console >/dev/console 2>&1 # fsck, etc.
link::wait:/sbin/sh -c "/sbin/rm -f /dev/syscon;                        /sbin/ln /dev/systty /dev/syscon" >/dev/console
2>&1
cprt::bootwait:/sbin/cat /etc/copyright >/dev/syscon           # legal req
sqnc::wait:/sbin/rc </dev/console >/dev/console 2>&1           # system init
#powf::powerwait:/sbin/powerfail >/dev/console 2>&1            # powerfail
cons:123456:respawn:/usr/sbin/getty console console            # system console
#ttp1:234:respawn:/usr/sbin/getty -h tty0p1 9600
#ttp2:234:respawn:/usr/sbin/getty -h tty0p2 9600
#ttp3:234:respawn:/usr/sbin/getty -h tty0p3 9600
#ttp4:234:respawn:/usr/sbin/getty -h tty0p4 9600
#ttp5:234:respawn:/usr/sbin/getty -h tty0p5 9600
ems1::bootwait:/sbin/rm -f /etc/opt/resmon/persistence/runlevel4_flag
ems2::bootwait:/sbin/cat </dev/null >/etc/opt/resmon/persistence/reboot_flag
ems3:3456:wait:/sbin/sh -c "/usr/bin/touch /etc/opt/resmon/persistence/runlevel4_flag; /usr/bin/chmod 644 /etc/opt/resmo
n/persistence/runlevel4_flag"
ems4:3456:respawn:/etc/opt/resmon/lbin/p_client
#ups::respawn:rtprio 0 /usr/lbin/ups_mond -f /etc/ups_conf
a0:3:off:/usr/sbin/getty -h ttyd2a1 1200
a1:3:off:/usr/sbin/getty -h ttyd2a2 1200
sh: init:3:initdefault::  not found.
# ioin::sysinit:/sbin/ioinitrc >/dev/console 2>&1
# tape::sysinit:/sbin/mtinit > /dev/console 2>&1
# muxi::sysinit:/sbin/dasetup   </dev/console >/dev/console 2>&1 # mux init
# stty::sysinit:/sbin/stty 9600 clocal icanon echo opost onlcr ixon icrnl ignpar </dev/systty
sh: stty::sysinit:/sbin/stty:  not found.
# brc1::bootwait:/sbin/bcheckrc </dev/console >/dev/console 2>&1 # fsck, etc.
#               /sbin/ln /dev/systty /dev/syscon" >/dev/console                                                      <
sh: link::wait:/sbin/sh:  not found.
# 2>&1
# cprt::bootwait:/sbin/cat /etc/copyright >/dev/syscon           # legal req
sh: cprt::bootwait:/sbin/cat:  not found.
# sqnc::wait:/sbin/rc </dev/console >/dev/console 2>&1           # system init
# #powf::powerwait:/sbin/powerfail >/dev/console 2>&1            # powerfail
# cons:123456:respawn:/usr/sbin/getty console console            # system console
sh: cons:123456:respawn:/usr/sbin/getty:  not found.
# #ttp1:234:respawn:/usr/sbin/getty -h tty0p1 9600
# #ttp2:234:respawn:/usr/sbin/getty -h tty0p2 9600
# #ttp3:234:respawn:/usr/sbin/getty -h tty0p3 9600
# #ttp4:234:respawn:/usr/sbin/getty -h tty0p4 9600
# #ttp5:234:respawn:/usr/sbin/getty -h tty0p5 9600
# ems1::bootwait:/sbin/rm -f /etc/opt/resmon/persistence/runlevel4_flag
sh: ems1::bootwait:/sbin/rm:  not found.
# ems2::bootwait:/sbin/cat </dev/null >/etc/opt/resmon/persistence/reboot_flag
sh: ems2::bootwait:/sbin/cat:  not found.
# /persistence/runlevel4_flag; /usr/bin/chmod 644 /etc/opt/resmo                                                     <
> n/persistence/runlevel4_flag"
sh: ems3:3456:wait:/sbin/sh:  not found.
# ems4:3456:respawn:/etc/opt/resmon/lbin/p_client
sh: ems4:3456:respawn:/etc/opt/resmon/lbin/p_client:  not found.
# #ups::respawn:rtprio 0 /usr/lbin/ups_mond -f /etc/ups_conf
# a0:3:off:/usr/sbin/getty -h ttyd2a1 1200
sh: a0:3:off:/usr/sbin/getty:  not found.
# a1:3:off:/usr/sbin/getty -h ttyd2a2 1200
sh: a1:3:off:/usr/sbin/getty:  not found.
#

ベストアンサー1

私は本当に悪いことを台無しにしましたか?次回はシステムが起動しないのか気になりますか?

いいえ、はい(つまり、システムが正常に起動したり、少なくとも問題は発生しません)。これで、現在の作業ディレクトリに奇妙な名前のファイルがある可能性がありますが(今すぐ削除できます)、ほとんどのファイルはコマンドによって「見つかりません」と拒否されるようです。 inittabこれは実際にはシェルスクリプトではないので、シェルに適したすべての行は純粋に偶然です。

次のことがあります。

ems2::bootwait:/sbin/cat </dev/null >/etc/opt/resmon/persistence/reboot_flag

あなたはそれを見つけました。私はこれがstdoutに出力されないエラーであると推測するので、ファイルは0に切り捨てられます。ただし、これは正しく実行されたときに実行される操作でもあります。これは明らかにフラグとして使用されるファイルノードです(つまり、存在する場合は何かを示しますが、内容はありません)。

ems3:3456:wait:/sbin/sh -c "/usr/bin/touch /etc/opt/resmon/persistence/runlevel4_flag; /usr/bin/chmod 644 /etc/opt/resmon/persistence/runlevel4_flag"

chmodその終わりに可能引用されているので実行されないかもしれませんが、実行されます。切り取りと貼り付けが改行文字のある改行文字を導入するところから出るかどうかによって異なります。たとえば、次のようになります。

runlevel4_flag; /usr/bin/chmod 644 /etc/opt/resmon/persistence/runlevel4_flag"

コロンの後の部分は実際のコマンドですが、runlevel4_flag"実際のファイルではありません。

ルートで作業するときは注意してください。 必要な場合にのみこれを実行してください。あなたが上級ユーザーでなければ、このようなものは実際に害を及ぼしません。

おすすめ記事