LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 06-13-2015, 07:29 AM   #1
joe_2000
Senior Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 1,016

Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
Clear all traces of "su password" mistake


Sometimes when I su to root I mistakenly type the root password right behind the su command, before hitting enter. That leads to the root password being written to the bash history in clear text and into /var/log/auth.log... (No passwd entry for user '<PASSWORD>')

Assuming normal, but not excessive paranoia - is there any way to recover from this situation safely, other than changing the root password?

E.g if I shred the bash history file and then run
Code:
history -c
and delete the critical lines from /var/log/auth.log - Does that sound reasonably safe? Or am I missing something important?
 
Old 06-13-2015, 08:05 AM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
run
Code:
history | grep -w su
and watch the output for hits.
get the line numbers for them.
Code:
history -d <linenumber>
history -a
when you're done.

As for the log file, you may have to edit that by hand, but after logrotate does it's thing, it may be a non-issue.
 
1 members found this post helpful.
Old 06-13-2015, 08:17 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
If you are that careless, don't use root.
Change the root password - that way logs are rendered irrelevant.
Use sudo.
 
1 members found this post helpful.
Old 06-13-2015, 08:59 AM   #4
joe_2000
Senior Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 1,016

Original Poster
Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
Quote:
Originally Posted by syg00 View Post
If you are that careless, don't use root.
Change the root password - that way logs are rendered irrelevant.
Use sudo.
I already changed the root password before even posting. The question was more out of curiosity.

And no, I don't want to use sudo except for special cases, plus it would not solve this particular problem, because the same mistake could happen when using sudo. And since you tend to have to type your password more often when using sudo, the likelihood of that happening would be even higher.

Granted, it wouldn't be the root password, but one with just as much power.
 
Old 06-13-2015, 09:01 AM   #5
joe_2000
Senior Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 1,016

Original Poster
Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
Quote:
Originally Posted by Habitual View Post
run
Code:
history | grep -w su
and watch the output for hits.
get the line numbers for them.
Code:
history -d <linenumber>
history -a
when you're done.
Thanks for this, did not know these history options before.
 
Old 06-13-2015, 02:27 PM   #6
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
You are very welcome.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
"clear" and "reset" bash commands broken AviJacobson Linux - General 6 07-03-2006 06:28 AM
"clear" and "reset" bash commands broken AviJacobson Linux - Software 1 06-29-2006 02:31 PM
how do i replace the clear "clear screen" with the cls command thefedexguy SUSE / openSUSE 2 12-02-2005 05:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 02:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration