Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
15
rated 0 times [  15] [ 0]  / answers: 1 / hits: 17011  / 3 Years ago, wed, october 20, 2021, 7:39:24

I use rkhunter and I was wanting to check its logs with:



nano /var/log/rkhunter.log


But nano outputted this error:



Error reading /home/arthur-dent/.nano_history: Permission denied

Press Enter to continue starting nano.


And if I press ENTER I am able to view the file. I have checked the permissions for that file and they are now:



-rw-------   1 root        root           12 May  3 20:26 .nano_history


So I guess that I just change ownership back to me? But as I was literally just using nano, why would the permissions and ownership (possibly, as I do not know what the original ownership was) just suddenly change? Was it because I was just using it with sudo, if so, it is odd as nothing like this has ever happend before and I use sudo with it a lot?






OS Information:



Description:    Ubuntu 15.04
Release: 15.04


Package Information:



nano:
Installed: 2.2.6-3
Candidate: 2.2.6-3
Version table:
*** 2.2.6-3 0
500 http://gb.archive.ubuntu.com/ubuntu/ vivid/main amd64 Packages
100 /var/lib/dpkg/status

More From » permissions

 Answers
0

This is possible if .nano_history does not exist and you edit any file as root. Start a search action with Ctrl+W and .nano_history has the wrong ownership.



sudo chown arthur-dent:arthur-dent /home/arthur-dent/.nano_history


Later, the ownership of the file will not be changed.



I've tested:



% ls -l .nano_history
ls: cannot access .nano_history: No such file or directory

% sudo nano ~/tmp/<any_file>


Ctrl+W



Search anything.



Ctrl+X



% ls -l .nano_history
-rw------- 1 root root 6 Mai 3 22:08 .nano_history

% sudo chown aboettger:aboettger .nano_history
% ls -l .nano_history
-rw------- 1 aboettger aboettger 6 Mai 3 22:08 .nano_history

% sudo nano ~/tmp/<any_file>


Ctrl+W



Search anything.



Ctrl+X



% ls -l .nano_history  
-rw------- 1 aboettger aboettger 11 Mai 3 22:11 .nano_history

[#20190] Thursday, October 21, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
wenceslockro

Total Points: 494
Total Questions: 127
Total Answers: 97

Location: Chad
Member since Mon, Dec 5, 2022
1 Year ago
;