Bug 64103 - .bash_history and sudo
Summary: .bash_history and sudo
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: bash
Version: 7.2
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: wdovlrrw
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2002-04-25 17:44 UTC by Florin Andrei
Modified: 2008-05-01 15:38 UTC (History)
0 users

Clone Of:
Last Closed: 2002-08-01 11:31:13 UTC

Attachments (Terms of Use)

Description Florin Andrei 2002-04-25 17:44:41 UTC
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 11:31:08 UTC
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.