Bug 146934 - Sudo: Can't use rm as another user.
Summary: Sudo: Can't use rm as another user.
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: sudo
Version: 2.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Peter Vrabec
QA Contact: Ben Levenson
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-02-02 21:03 UTC by Francis Arsenault
Modified: 2007-11-30 22:06 UTC (History)
1 user (show)

(edit)
Clone Of:
(edit)
Last Closed: 2006-08-29 09:33:28 UTC


Attachments (Terms of Use)

Description Francis Arsenault 2005-02-02 21:03:28 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5)
Gecko/20041107 Firefox/1.0

Description of problem:
As user1 I tried removing a file owned by user2:user2 via sudo but i
got this message: rm: cannot lstat `.': Permission denied. I made a
lot of test on HP-UX, RHEL21AS and RHEL3 with sudo 1.6.5 to 1.6.6.
Only HP-UX works fine, that's kind of weird though. All other commands
(running a script, creating a file, ...)work fine.

Version-Release number of selected component (if applicable):
tested from 1.6.5 to 1.6.6

How reproducible:
Always

Steps to Reproduce:
* For testing purpose all files are in 755 mode.

1. Create user1(1200:1200) and user2 (300:300)

2. Create file /home/user1/test1 owned by user1:user1 and containing: 
      id
      /usr/local/bin/sudo -u user2 /home/test2

3. Create file /home/test2 owned by user2:user2 and containing:
      id
      [ -f /home/user2/test3 ] && /bin/rm -f /home/user2/test3

4. `touch /home/user2/test3` owned by user2:user2

5. visudo or edit /etc/sudoers file :
      user1     ALL=(user2) NOPASSWD: /home/test2

6. `su - user1` and type `./test1`. See

Actual Results:  uid=1200(user1) gid=1200(user1) groups=1200(user1)
uid=300(user2) gid=300(user2) groups=300(user2)
rm: cannot lstat `.': Permission denied

File /home/user2/test3 is still there.

Expected Results:  uid=1200(user1) gid=1200(user1) groups=1200(user1)
uid=300(user2) gid=300(user2) groups=300(user2)

and file /home/user2/test3 should be removed.

Additional info:

Comment 1 Karel Zak 2005-09-19 14:41:21 UTC
Why do you think that it is the sudo bug? I see that output from command id is
correct.

Try modify /home/test2 to:

   id
   pwd
   cd /home/user2
   [ -f /home/user2/test3 ] && /bin/rm -f /home/user2/test3


Note You need to log in before you can comment on or make changes to this bug.