Question

Backstory: I SSH into servers where I want to see a personalized root prompt. However, other people log onto these servers and don't necessarily want me changing the prompt.

Question: How can I make a zsh alias/function such that I can log in as a regular user, and typing [my su shortcut] will launch a su session, source .zshrc from my personal home directory, and leave me at a root prompt?

Was it helpful?

Solution

alias mysu="su -c \"ZDOTDIR=$HOME zsh\""

See zsh(1) for details.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top