Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Jun 2002 16:17:16 -0600
From:      Chris Fedde <chris@fedde.littleton.co.us>
To:        Andrew <perl@ukrpost.net>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Sudo 
Message-ID:  <200206122217.g5CMHGt9049543@fedde.littleton.co.us>
In-Reply-To: <1378131622.20020612235319@ukrpost.net> 

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 12 Jun 2002 23:53:19 +0300  Andrew wrote:
 +------------------
 |   Hello list.
 | 
 |   Is  there  a way to force sudo read .profile? For example, I have an
 | alias  vi='vim'  in both root's and user's .profiles. When I run vi as
 | root being user it starts vi instead of vim.
 | 
 +------------------

It sounds like you are using 'sudo su' or 'sudo bash'  or some
similar incantation.  That is not the easiest way of using sudo. 
I like to sodo each command:

    sudo vi /some/file
    sudo /usr/local/etc/rc.d/myprog start
    sudo /usr/sbin/sendmail -bv some@addresss

Doing it this way you take avantage of your shells command
history, aliases and paths.

If you realy want to sudo to a shell you can choose to source the
.profile for that shell by telling the shell to load it using an option.

    sudo bash --login

--
    Chris Fedde

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206122217.g5CMHGt9049543>