Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Sep 2009 02:28:52 +0200
From:      Polytropon <freebsd@edvax.de>
To:        Dan Nelson <dnelson@allantgroup.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: 'alias' + sudo
Message-ID:  <20090903022852.3223abec.freebsd@edvax.de>
In-Reply-To: <20090902200648.GF2855@dan.emsphone.com>
References:  <20090902072659.7829da56@scorpio.seibercom.net> <ade45ae90909021206u43135147u1f9431c10a043dda@mail.gmail.com> <20090902152821.6baf568c@scorpio.seibercom.net> <20090902200648.GF2855@dan.emsphone.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 2 Sep 2009 15:06:48 -0500, Dan Nelson <dnelson@allantgroup.com> wrote:
> sudo does not run root's shell at all; it directly runs whatever is given it
> on the commandline.

Another idea would to be to call sudo with the desired shell as
argument (in order to inherit the aliases), followed by a command
as argument to the shell (in order to execute a particular command),
something like

	% sudo bash -c "my_command_alias"

It may be possible that bash requires an additional argument to tell
it to read ~/.bashrc when invoked in a non-interactive manner.

Keep in mind that I haven't tried this solution because I don't
use bash on a regular basis.


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



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