Alias command works for one user, but not another - Help

This is a discussion on Alias command works for one user, but not another - Help ; I recently added two users to my system. I wnat to give them the ability to shutdown/ reboot without having to su to root, so I added them to the /etc/sudoers file: user1 MachineName = NOPASSWD: /sbin/halt, /sbin/shutdown, /sbin/reboot I ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Alias command works for one user, but not another

  1. Alias command works for one user, but not another

    I recently added two users to my system. I wnat to give them the ability
    to shutdown/ reboot without having to su to root, so I added them to
    the /etc/sudoers file:
    user1 MachineName = NOPASSWD: /sbin/halt, /sbin/shutdown, /sbin/reboot

    I then added the alias commands to user1's .bashrc file:

    alias halt='sudo halt'
    alias shutdown='sudo shutdown'
    alias reboot='sudo reboot'

    Everything works fine for user1.

    Then I added user2; same commands and syntax in /etc/sudoers and
    user2/.bashrc.
    However, the aliases for user2 don't work. All I get is
    '-sh: halt:command not found.'
    I can use 'sudo halt,' etc., from the command line, but the aliases
    don't work.
    The permissions on the .bashrc files is the same, and each user owns their
    respective .bashrc.
    Does anybody have any suggestions to help me out?

    Debian Sarge is the distro involved.

    This is kind of important. I'm trying to get a Very Important Client
    (aka My Wife) to change her mind about using Linux. The more things I can
    simplify, the more she'll like it.

    Thank you

    Richard L. Dery

  2. Re: Alias command works for one user, but not another

    On 2004-06-04, Richard L. Dery wrote:
    > I recently added two users to my system. I wnat to give them the ability
    > to shutdown/ reboot without having to su to root, so I added them to
    > the /etc/sudoers file:
    > user1 MachineName = NOPASSWD: /sbin/halt, /sbin/shutdown, /sbin/reboot
    >
    > I then added the alias commands to user1's .bashrc file:
    >
    > alias halt='sudo halt'
    > alias shutdown='sudo shutdown'
    > alias reboot='sudo reboot'
    >
    > Everything works fine for user1.
    >
    > Then I added user2; same commands and syntax in /etc/sudoers and
    > user2/.bashrc.
    > However, the aliases for user2 don't work. All I get is
    > '-sh: halt:command not found.'
    > I can use 'sudo halt,' etc., from the command line, but the aliases
    > don't work.
    > The permissions on the .bashrc files is the same, and each user owns their
    > respective .bashrc.


    I figured it out. User2 was created with a login shell of /bin/sh. User1
    has a login shell of /bin/bash.

    Lesson: There's always one more thing to look at in Linux when you're trying
    to solve a problem.

    Dick Dery


+ Reply to Thread