The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Special Forums > Security
.
google unix.com



Security Discuss UNIX and Linux computer and network security, cybersecurity, cyberattacks, IT security, CISSP, OWASP and more.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Displaying a dialog box using terminal commands keshav.murthy@r Shell Programming and Scripting 1 07-16-2008 12:36 PM
Can't login root account due to can't find root shell neikel AIX 2 01-30-2008 11:07 PM
How to allow root login from a specified terminal ? XP_2600 SUN Solaris 3 11-27-2006 04:01 AM
Terminal Commands indigoecho UNIX for Dummies Questions & Answers 5 12-16-2003 01:41 AM
won't allow root login from another terminal to my sun kymberm UNIX for Dummies Questions & Answers 3 07-03-2003 01:11 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-27-2008
Reboot's Avatar
Reboot Reboot is offline
Registered User
  
 

Join Date: Sep 2008
Location: Asia Pecific.
Posts: 31
Quote:
Originally Posted by vampirodolce View Post
Hi Reboot,
for some reason when I use script (/usr/bin/script) in .bashrc, as soon as the user logs in the shell goes crazy (e.g. CPU 100%) and the output file - typescript in my case - becomes huge. Do you know why?
The command 'script' on a command line works just fine, it's the .bashrc that doesn't like it. I am using Debian Etch.

Could you show the entries (or commands) you are putting in /.bashrc file......
  #2 (permalink)  
Old 10-30-2008
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,934
If you are on a Linux box, you could use Snoopy. Quoting from the Sourceforge webpage:
Quote:
Snoopy is designed to aid the task of a sysadmin by providing a log of commands executed. Snoopy is completely transparent to the user and applications. It is linked into programs to provide a wrapper around calls to execve(). Logging is done via syslogd
  #3 (permalink)  
Old 10-27-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,789
As an answer to the original problem try something like this in /etc/profile

Code:
    RU=`who am i | cut -f 1 -d " "`
    if [[ $RU = "root" ]]
      then
        HISTFILE=/someplace_safe/.ihist/.sh_hist_$RU_$$
        HISTSIZE=1000
        export HISTFILE HISTSIZE
      else
        HISTFILE=/$HOME/.sh_history
        HISTSIZE=1000
        export HISTFILE HISTSIZE
    fi

This creates a history file for each root login, the mtime of the file gives you a clue as to which "root" login you are dealing with.
  #4 (permalink)  
Old 10-28-2008
Reboot's Avatar
Reboot Reboot is offline
Registered User
  
 

Join Date: Sep 2008
Location: Asia Pecific.
Posts: 31
Quote:
Originally Posted by jim mcnamara View Post
As an answer to the original problem try something like this in /etc/profile

Code:
    RU=`who am i | cut -f 1 -d " "`
    if [[ $RU = "root" ]]
      then
        HISTFILE=/someplace_safe/.ihist/.sh_hist_$RU_$$
        HISTSIZE=1000
        export HISTFILE HISTSIZE
      else
        HISTFILE=/$HOME/.sh_history
        HISTSIZE=1000
        export HISTFILE HISTSIZE
    fi

This creates a history file for each root login, the mtime of the file gives you a clue as to which "root" login you are dealing with.



This is also a good Solution.........
Thanks jim mcnamara....
  #5 (permalink)  
Old 10-29-2008
vampirodolce's Avatar
vampirodolce vampirodolce is offline
Registered User
  
 

Join Date: Oct 2008
Location: Italy
Posts: 9
Quote:
Originally Posted by Reboot View Post
Could you show the entries (or commands) you are putting in /.bashrc file......
Hi, I am using the standard ~/.bashrc shipped with Debian, with some minor changes I made e.g. to umask, Mail, Histfilesize, Histsize and PS1 (which now shows the % of the battery):

Quote:
debian@localhost:100%~$ cat .bashrc|grep ^[^#]

[ -z "$PS1" ] && return
export HISTCONTROL=ignoredups
shopt -s checkwinsize
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
case "$TERM" in
xterm-color)
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
;;
*)
PS1='${debian_chroot:+($debian_chroot)}\u@\h:$(echo $(acpi)|/usr/bin/cut -f4 -d\ |cut -f1 -d,)\w\$ '
;;
esac
case "$TERM" in
xterm*|rxvt*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
;;
*)
;;
esac
if [ "$TERM" != "dumb" ]; then
eval "`dircolors -b`"
alias ls='ls -F --color=auto'
fi
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
umask 077
MAIL=~/Maildir
export MAIL
HISTFILESIZE=400
export HISTFILESIZE
HISTSIZE=400
export HISTSIZE
The 'script' command I used was very simple, some kind of '/usr/bin/script -q ~/file.log'
  #6 (permalink)  
Old 10-29-2008
Reboot's Avatar
Reboot Reboot is offline
Registered User
  
 

Join Date: Sep 2008
Location: Asia Pecific.
Posts: 31
Hi...
First see wether all perameters which you want to change through ~/.bashrc file, changes as per your requirement.In short wether all commands (Excluding '/usr/bin/script ) in ~/.bashrc file work fine......

If yes then just put the '/usr/bin/script -q ~/file.log' command at the very last line of your ~/.bashrc file and then see wether it works or not....

Do not put the '/usr/bin/script -q ~/file.log' command at begining or anywhere in between the ~/.bashrc file .

Hope it should work this time now.....

Cheers....

Last edited by Reboot; 10-29-2008 at 05:03 PM..
  #7 (permalink)  
Old 10-31-2008
vampirodolce's Avatar
vampirodolce vampirodolce is offline
Registered User
  
 

Join Date: Oct 2008
Location: Italy
Posts: 9
Quote:
Originally Posted by Reboot View Post
Hi...
First see wether all perameters which you want to change through ~/.bashrc file, changes as per your requirement.In short wether all commands (Excluding '/usr/bin/script ) in ~/.bashrc file work fine......

If yes then just put the '/usr/bin/script -q ~/file.log' command at the very last line of your ~/.bashrc file and then see wether it works or not....

Do not put the '/usr/bin/script -q ~/file.log' command at begining or anywhere in between the ~/.bashrc file .

Hope it should work this time now.....

Cheers....
Same as before. I created a sample .bashrc containing the 'script -q ~/file.txt' line only.
Closed Thread

Bookmarks

Tags
linux commands

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:33 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0