Search code examples
rhel7powershell-7.0

Error reading or writing history file in PowerShell on Linux


I've just had PS 7.0.2 installed on 2x boxes running RHEL 7.x (maipo). Oddly enough, one of them is showing the following error

    $ pwsh
    PS /home/user_name> dir
    Error reading or writing history file '/home/user_name/.local/share/powershell/PSReadLine/Console_history.txt': Access to the path '/home/user_name/.local/share/powershell/PSReadLine/Console_history.txt' is denied
    PS /home/user_name> exit
    Error reading or writing history file '/home/user_name/.local/share/powershell/PSReadLine/Console_history.txt': Access to the path '/home/user_name/.local/share/powershell/PSReadLine/Console_history.txt' is denied
    This error will not be reported again in this session. Consider using a different path with:
      Set-PSReadLineOption -HistorySavePath <Path>
    Or not saving history with:
      Set-PSReadLineOption -HistorySaveStyle SaveNothing

I can't figure out why. All I did was download the RPM and install it. And both the boxes are practically copies of each other :(

Any suggestions?


Solution

  • Err .. just figured it out. It was an errant umask setting overriding the default in my ~/.bashrc.

    Commenting it out solved the problem.