sudo / user - profile question

eric_forgette at eric_forgette at
Wed Feb 16 12:36:00 EST 2000

From: Todd C. Miller at Todd.Miller on 02/15/2000 03:49 PM

cc:   sudo-users at at SMTP@Exchange

Subject:  Re: sudo / user - profile question

In message <85256886.0071B173.00 at>
     so spake  (forgettee):

> Quick sudo question...
> How can I get the .profile to source automatically when a user sudos to anoth
> er
> user?
> The example below doesn't cause the .profile to execute.
> sudo -H -u user2 /usr/bin/ksh

Ksh only source .profile if the shell name starts with a '-' or
the -l option is given, so:
    sudo -H -u user2 /usr/bin/ksh -l
should do the trick.

 - todd

Todd - Thanks for the quick response.

I should have provided more information.

I am running sudo on a Solaris 2.6 box.  The -l is not available.

In fact the man page states that ksh should always source the .profile.

There is a -p option to prevent the .profile from being executed.  I can use the
      "-" in

the case of:

 su - user2

How could I get the "-" to work with sudo?  Any ideas?



More information about the sudo-users mailing list