'alias' + sudo
Randy Belk
randy.belk at gmail.com
Fri Sep 4 16:30:01 UTC 2009
On Fri, Sep 4, 2009 at 10:50 AM, George Davidovich<freebsd at optimis.net> wrote:
> On Thu, Sep 03, 2009 at 08:10:36PM -0400, Jerry wrote:
>> On Fri, 4 Sep 2009 01:34:05 +0200 Mel Flynn wrote:
>>
>> > alias spico='/usr/local/bin/sudo pico -m' and be done with it.
>
> Instead of an extra alias, why not export $VISUAL or $EDITOR, and rely
> on sudoedit(8)?
>
>> That is what I am currently doing; however,there are other commands
>> that I want to use that are not available when used via sudo without
>> modifying the alias. I did not realize that sudo had such a
>> limitation.
>
> It's not a "limitation". It's a feature. ;-) Re-read the sudo
> manpage.
>
> I'd be surprised if most of your aliases would ever require root
> privileges, and are anything but one-off shortcuts for your personal
> use.
>
> For those that do, I'd suggest replacing them with a function (or
> script) that tests for root privileges (using something like id(1)), and
> invokes sudo when appropriate.
>
> Otherwise, you may want to consider using 'su -m'. That will your
> current environment unmodified and all your existing aliases will remain
> available for use.
>
> --
> George
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
>
There is a way for what you are wanting to do.
Make an alias for sudo that looks like this "sudo='sudo -E (Your default shell)"
Since I use zsh my alias looks like this sudo='sudo -E zsh'
It perserves all of your aliases, paths, and everything else
.
--
- Amiga, The Computer for the creative Mind!
- UNIX is basically a simple operating system, but you have to be a
genius to understand the simplicity.
- People who hate Microsoft Windows use Linux but people who love UNIX use BSD.
More information about the freebsd-questions
mailing list