sudo does not recognize bash aliases

Bug #275713 reported by yourpalal
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
sudo (Ubuntu)
Confirmed
Wishlist
Unassigned

Bug Description

Binary package hint: sudo

For example:
I have the following user defined alias, as reported by 'alias':"alias IDLE='/usr/bin/idle-python2.5'"
However, upon enter the following command "sudo IDLE": I am given the following error:
    sudo: IDLE: command not found

I am running 8.04 with sudo at version 1.6.9p10-1ubuntu3.3

Revision history for this message
yourpalal (alexsleeps) wrote :

A workaround for anyone else experiencing this problem is to spawn a root terminal for example 'sudo xterm' and then run your aliases from there.

Revision history for this message
Martin Pitt (pitti) wrote :

Realistically this isn't going to change anytime soon. It would either require bash to know details and hacks about sudo, or sudo to know details and hacks about bash, neither is really desirable.

Changed in sudo:
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
Tyler Rick (tyler.rick) wrote :

Another workaround (described at http://ubuntuforums.org/showthread.php?t=217188) is to create an alias for sudo like this:

alias sudo='A=`alias` sudo '

Revision history for this message
Juhos Csaba-Zsolt (csaba-juhos) wrote :

Actually the
A=`alias`
part is redundant. A simple
alias sudo='alias '
suffices.

From bash.info 6.6 Aliases: "If the last character of the alias value
is a space or tab character, then the next command word following the
alias is also checked for alias expansion."

Csabi

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.