Wednesday, September 08, 2021

Re: Are there any protection againts heisting the "shell builtin"s?

> Date: Wed, 8 Sep 2021 11:24:18 +0200
> From: jim hook <jimhook7475@mail.com>

> Thinking of that home dirs could be on a shared storage, that can be
> accessed by others and maliciously modify the ".profile", etc. files
> of the targeted user.
>
> ex.: "unset cd" would help, but any solution in general?


> Date: Wed, 8 Sep 2021 19:41:46 +0959
> From: Reuben ua Bríฤก <u5644051@anu.edu.au>

> directory permissions. in code:
>
> for u in /home/*
> do chown "$u" "/home/$u"
> chmod go-w "/home/$u"
>
> which you should find is already the default.


oops, wrong code. i meant

cd /home
for u in *
do set -- "$u" "$u/.profile"
chown "$u" "$@"
chmod go-w "$@"
done

assuming you have the usual directory set-up.
a more general solution would involve parsing /etc/passwd

No comments:

Post a Comment