Ubuntu – Nano – Error reading /home/username/.nano_history: Permission denied

I really like using nano for quick and simple editing of text files on my Ubuntu systems. This means that I mostly use sudo nano but because I also run nano as a user I experience the following error:

Error reading /home/<username>/.nano_history: Permission denied
Press Enter to continue starting nano.

The fix requires editing the nano configuration file /etc/nanorc and deleting /home/<username>/.nano_history.

First comment out the set historylog parameter of nanorc with this command: sudo nano /etc/nanorc

#set historylog

This will disable  the ~/.nano_history file used for saving and reading search /replace strings.

This still leaves the .nano_history file in your user directory. Delete this file as follows:

sudo rm .nano_history

That’s it!


Ubuntu Manuals
Ubuntu Forums

12 thoughts on “Ubuntu – Nano – Error reading /home/username/.nano_history: Permission denied

  1. In my experience, this just happens after setting up a new account. If I use ‘nano’ to create or edit a file before I need to run ‘sudo nano’, the .nano_history file gets created with the proper ownership. Running ‘sudo nano’ later shouldn’t cause that to change ownership.

Leave a Reply to Nathaniel Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s