Re: sudo with my aliases



sam.s.kong@xxxxxxxxx wrote:
Hi Michael,

Michael Heiming wrote:
In comp.os.linux.misc sam.s.kong@xxxxxxxxx:
Hello,
sudo command doesn't understand the alias I defined.
How can I make "sudo" work with the aliases I defined for my account?
Presuming standard setup, put in your script near top:

# Source user environment
. /home/${SUDO_USER}/.bashrc

I think I've already set it up like you said.
The thing is that I'm using a mac (Tiger).

/Users/sam/.bash_login has the alias definitions.
But the aliases don't work with sudo.
Are you sure that it works?

..bash_login is only used during login. Try .bashrc
.



Relevant Pages

  • Re: alias + sudo
    ... Instead of an extra alias, why not export $VISUAL or $EDITOR, and rely ... that I want to use that are not available when used via sudo without ... I'd be surprised if most of your aliases would ever require root ... People who hate Microsoft Windows use Linux but people who love UNIX use BSD. ...
    (freebsd-questions)
  • Sudo question
    ... I have a sudo user that would like to use a list of aliases set for ... root .profile file. ... putting the aliases in the sudoers file but am not sure if it can be done. ...
    (SunManagers)
  • Re: aliases for use in ubuntu
    ... > It seems that in ubuntu, the aliases have to be in /etc/bash.bashrc ... Note that can't just add the alias, if you put it in one of the bashrc files ... The 'sudo' should come anywhere you would normally need to type it if you ...
    (Ubuntu)
  • Re: Environment and Sudo
    ... aliases. ... Example would be the alias vi="vim". ... Invoking normally will run vim, ... using sudo vi will get the "other" vi. ...
    (Debian-User)
  • Re: sudo with my aliases
    ... How can I make "sudo" work with the aliases I defined for my account? ... Presuming standard setup, put in your script near top: ...
    (comp.os.linux.misc)