0

Suppose the default shell for root is sh, my default shell is zsh, but I want to run a command in csh with sudo. How?

According to man sudo, -l will give zsh (my shell).

-i can give me csh, but only if a user exists that has csh for a default shell and I specify that user with -u.  Unfortunately, it also gives the command that user's login environment, which may not be wanted.

1 Answer 1

2
SHELL=/bin/csh sudo -s

will accomplish this.

2
  • The OP says "want to run a command in csh with sudo", why wouldn't he just use sudo csh -c "command" ? Jan 15 at 5:45
  • @MarcWilson Ah right, if they only want to run one command that will work as well of course.
    – nohillside
    Jan 15 at 6:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .