mainThe GNU Bourne-Again SHell - Support: sr #107770, No clear indication of error if...


sr #107770: No clear indication of error if .bash_history exists but not accessible

Submitter:  Michael V. Antosha <mivael>
Submitted:  Tue 09 Aug 2011 03:27:30 PM UTC
Category:  None Priority:  5 - Normal
Severity:  2 - Minor Status:  Wont Do
Privacy:  Public Assigned to:  None
Open/Closed:  Open Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup

Tue 09 Aug 2011 03:27:30 PM UTC, original submission:  

If .bash_history exists but not accessible, bash behaves exactly the same way as if there were no .bash_history (beeps when trying to call the previous command from history).  Moreover, after bash exits, no history will be saved with no indication of error.

Steps to reproduce (start as root, user1 exists in the system):
1. cd /home/user1/
   echo 'ls -la' >> .bash_history   # if not exists
   chown root:root .bash_history
   chmod a=,u+rw .bash_history
2. sudo -u user1 bash
3. Try to call previous command from history (press UP-ARROW).  No previous command available (beep), no error messages.
4. echo test1234  # for history
5. exit  # return from sudo
6. tail .bash_history  # 'echo test1234' not saved in history
7. chown user1 .bash_history
8. Repeat steps 2-6, note the difference in steps 3 and 6.

Use case example:
I encountered this error after fresh install of a GNU/Linux (Trisquel Slaine) because the first command I run from terminal was 'sudo bash'.  This way .bash_history with root as owner was created in my home directory.

Michael V. Antosha <mivael>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by chet (Updated the item)
  • -email is unavailable- added by mivael (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-01-17 chet StatusNone Wont Do

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code