Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 64103 - .bash_history and sudo
.bash_history and sudo
Product: Red Hat Linux
Classification: Retired
Component: bash (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: wdovlrrw
Depends On:
  Show dependency treegraph
Reported: 2002-04-25 13:44 EDT by Florin Andrei
Modified: 2008-05-01 11:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-08-01 07:31:13 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Florin Andrei 2002-04-25 13:44:41 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 Galeon/1.2.0 (X11; Linux i686; U;) Gecko/20020326

Description of problem:
If i login as a regular user, the file .bash_history is created just fine, with
right ownership and permissions, etc.
But as soon as i "sudo bash", then .bash_history is created with root ownership.
If i exit back to the regular user, i don't have permissions to write to the
file anymore.
Bash should create .bash_history with the original user's ownership, no matter
if i sudo or not.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. sudo bash
2. execute a few commands
3. exit back to regular user

Actual Results:  .bash_history has root:root ownership and is not readable as
regular user

Expected Results:  .bash_history should retain the ownership of the actual user
that's running the shell, no matter if bash is run via sudo or not

Additional info:
Comment 1 Bernhard Rosenkraenzer 2002-08-01 07:31:08 EDT
Not reproducable in the current release. 
[bero@zell bero]$ ls -l .bash_history 
-rw-------    1 bero     bero         6823 Aug  1 13:28 .bash_history 
[bero@zell bero]$ sudo bash 
[root@zell bero]# echo test 
[root@zell bero]# exit 
[bero@zell bero]$ ls -l .bash_history 
-rw-------    1 bero     bero         6838 Aug  1 13:30 .bash_history 
[bero@zell bero]$ 

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