리눅스 분류
history 명령 질문입니다.
작성자 정보
- linuxSB 작성
- 작성일
컨텐츠 정보
- 2,658 조회
- 1 댓글
- 0 추천
- 목록
본문
안녕하세요 리눅스 초보입니다.
history 명령어를 입력하면 이전에 입력한 명령이 나오는데요
보안차원으로 history 명령을 사용하면 시간이 나오게 설정하였습니다.
export HISTTIMEFORMA='[%F %T] '
1. 명령을 입력했는지 사용자 계정이 나오게 할수는 없나요?
형식으로 history설정을 하고싶은데 어떻게 해야하나요?
[root/2013-12-04 11:47] ls -al
2. root와 test 계정이 있는데 history를 입력하면 root가 입력한 명령만 나오는데, test 계정이
사용한 명령까지 다 history에 나오게 하려면 어떻게 해야하나요?
history 명령어를 입력하면 이전에 입력한 명령이 나오는데요
보안차원으로 history 명령을 사용하면 시간이 나오게 설정하였습니다.
export HISTTIMEFORMA='[%F %T] '
1. 명령을 입력했는지 사용자 계정이 나오게 할수는 없나요?
형식으로 history설정을 하고싶은데 어떻게 해야하나요?
[root/2013-12-04 11:47] ls -al
2. root와 test 계정이 있는데 history를 입력하면 root가 입력한 명령만 나오는데, test 계정이
사용한 명령까지 다 history에 나오게 하려면 어떻게 해야하나요?
관련자료
-
이전
-
다음
댓글 1
쭈운님의 댓글
- 쭈운
- 작성일
history 명령어로는 구현이 어려울듯 하네요..
다른 방법이 있습니다.
/etc/profile 에 아래 내용을 추가
function history_to_syslog
{
declare command
remoteaddr="`who am i`"
command=$(fc -ln -0)
if [ "$command" != "$old_command" ]; then
logger -p local1.notice -t bash -i ? "$USER : $remoteaddr" : "$command"
fi
old_command=$command
}
trap history_to_syslog DEBUG
/etc/syslog.conf에 아래내용추가
local1.notice /var/log/cmd.log
# service syslog restart
/var/log/cmd.log 에 로그가 남습니다.
다른 방법이 있습니다.
/etc/profile 에 아래 내용을 추가
function history_to_syslog
{
declare command
remoteaddr="`who am i`"
command=$(fc -ln -0)
if [ "$command" != "$old_command" ]; then
logger -p local1.notice -t bash -i ? "$USER : $remoteaddr" : "$command"
fi
old_command=$command
}
trap history_to_syslog DEBUG
/etc/syslog.conf에 아래내용추가
local1.notice /var/log/cmd.log
# service syslog restart
/var/log/cmd.log 에 로그가 남습니다.