(go) How Linux makes history not log sensitive commands

Source: Internet
Author: User

Sometimes for server security, to prevent others from prying into the commands we enter, we can clear the history, and more often we choose to force history to not remember the command when entering special commands. Experimental method: Execute the Export histcontrol=ignorespace command first, then output Ls-tra, PWD and service mysqld Start command, when the third command is executed, we choose not to remember the command.


# export histcontrol=ignorespace 
# ls-ltr
Total 168
-rw-r--r--1 root root   5520 Dec 25  2014 install.log.syslog
-rw-r--r--1 root root 12754 Dec 25  2014 install.log< BR>-RW-------1 root root  2005 Dec 25  2014 anaconda-ks.cfg
-rw-r--r--1 root root    1 2 dec  9 21:11 a.txt

# pwd

#   service mysqld start    ( Note that this command is preceded by a space)
and then we'll look at the history
# history |tail-3
  844  2016-12-12 17:01:55 ls- LTR
  845  2016-12-12 17:01:59 pwd
  846  2016-12-12 17:02:36 History |tail-3

didn't find out what we just did, service mysqld start did not have
Note: If you do not want historical records to remember which command, directly in the execution of the command, add a space.

Of course someday you want to empty all history commands can be executed:
# history-c   //Clear All Records
# history        & nbsp;//to see if it is emptied
    1  2016-12-12 17:12:12 history 

Tags:linux History Sensitive commands

respect for sharing, welcome reprint, please consciously add this article link, thank you! This article link: https://www.601849.com/post/139.html

(go) How Linux makes history not log sensitive commands

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.