realpath in PS1 bash
Hi folks
I didn't receive any response on debian-user, hopefully this is an
appropriate place to ask.
I'm wondering if it would be a good idea to have PS1 set to
'${debian_chroot:+($debian_chroot)}\u@\h:$(realpath "$(pwd)")\$ '
instead of the default
'${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
and make it a suggestion in /etc/skel/.bashrc for those users who want
to see the actual current working directory.
From a security standpoint you could enter e.g.
/home/someoneelse/somedir/ and see me@debian:/home/someoneelse/somedir/$
in the prompt, but really be in /etc/ if somedir is a (potentially
malicious) symlink to /etc created by a different user. It could get
quite disastrous if you decide to run something like rm -r * in such a
directory.
It won't be very helpful with more sophisticated symlink race
conditions, but it is better than nothing.
Perhaps I should post it to bash package wishlist, what do you think?
Peter Kuma
Reply to: