Portal Home > Knowledgebase > Articles Database > Clear last login IP in ssh and "last" command


Clear last login IP in ssh and "last" command




Posted by VL-Adam, 07-11-2009, 06:01 PM
Hello, How can I clear the last login IP address in SSH, when you login it'll say Last login from: xx.xxx.xxx.xx and etc.. Also when you use the "last" command. How can you clear these? I am creating an OS template for my VPS nodes and thought it'd be better to clear these before proceeding to make them. I appreciate any help. Thank you!

Posted by VL-Adam, 07-11-2009, 06:27 PM
Hello, Never mind, I figured it out. For anyone who wants to know how to do this, execute this command in root SSH: rm -rf /var/log/wtmp Thank you, ~ Adam

Posted by egmix, 07-11-2009, 07:08 PM
thanks for this info

Posted by VL-Adam, 07-12-2009, 04:22 AM
Glad to help.

Posted by mnaumann, 07-12-2009, 05:05 AM
var/log/lastlog, too, if it exists. You may also want to get rid off /var/log/auth.log, and possibly off all the logs in general, if the intention is to remove any usage patterns. In the latter case, also look at /var/spool and /var/lib

Posted by serveradminz, 07-12-2009, 09:15 AM
ya../var/log/lastlog may some time have the logs in it. Anyway thanks for the info mnaumann

Posted by team-vps, 07-12-2009, 12:31 PM
You might want to consider this command instead of removing the entire file: > /var/log/wtmp

Posted by JulesR, 07-12-2009, 12:36 PM
Yeah I agree with team-vps. Blanking a file is always better than removing it completely:

Posted by Crashus, 07-12-2009, 01:33 PM
var/log/messages can also contain logs of success ssh sessions so it is good to review them too.

Posted by nomankhn, 07-13-2009, 04:48 AM
and also do # history -c [ clear your all commandshistory whatever you type otherwise person will get from history whatever you did] Thanks, Noman



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
CSF vs APF (Views: 1808)
df -h (how 101% use) (Views: 505)