Bug 146934 - Sudo: Can't use rm as another user.
Sudo: Can't use rm as another user.
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: sudo (Show other bugs)
2.1
All Linux
medium Severity medium
: ---
: ---
Assigned To: Peter Vrabec
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-02-02 16:03 EST by Francis Arsenault
Modified: 2007-11-30 17:06 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-08-29 05:33:28 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Francis Arsenault 2005-02-02 16:03:28 EST
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 10:41:21 EDT
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.