Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
複数のマシンでユーザーのホーム フォルダーを定義しました。しかし、サーバーの 1 つにホーム フォルダーがありません。ホーム フォルダが見つからないサーバーを特定するにはどうすればよいですか?
たとえば、ユーザー名は次のとおりです: my_user サーバーは次のとおりです: host1、host2、host3、host4
マシンの 1 つで /home/my_user が見つかりません。
たぶん次のようなもの:
ホスト 1、ホスト 2、ホスト 3 の場合。などなど
以下に示すように、forループを使用します。ssh
for
ssh
for host in host1 host2 host3 do ssh "$host" '[ ! -d /home/my_user ] && echo "Does not exist on $(hostname)"' done