You are trying to change the prompt displayed by the remote shell. This, of course, requires changing the configuration file of the remote shell, i.e.
If you don't want to change the file, and you really have to use that shared account (insert obligatory grumble about shared accounts), and you're logging in over ssh, you can (ab)use the
command= option in the
~/.ssh/authorized_keys file. A key with a command option is good only for running the specified command; but the command in the authorized_keys file runs with the environment variable
SSH_ORIGINAL_COMMAND set to the command the user specified (empty for interactive sessions). So you can use something like this in
if [ -n \"$SSH_ORIGINAL_COMMAND\" ]; then
else exec \"$SHELL\"; fi" ssh-rsa AAAA…== email@example.com
Note that I put line breaks above for legibility, but this actually needs to be all on one line in the
Then put your favorite configuration files in that
For occasional use, you can explicitly source a profile file or run any shell command. Pass the
-t option to have a terminal if you want to run interactive commands.
ssh shared-account@server "LS_COLORS='$LS_COLORS' ls --color"
ssh -t shared-account@server '. ~/.profile.drew; exec zsh'
If you only want to edit or copy files on the remote machine, you can use a network filesystem such as SSHFS (for unix clients) or Tramp (for Emacs) and work from the comfort of your local environment.