LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Find and delete logout script (https://www.linuxquestions.org/questions/linux-newbie-8/find-and-delete-logout-script-712476/)

laurens 03-18-2009 06:47 AM

Find and delete logout script
 
Hi all,

I have to remove (or deactive) a script a previous system administrator installed on a server. When a user logs out, when you type exit, the following is displayed:
Code:

logout
updating slocate database

I did some research and thought I solved it when I found a script slocate.cron in /etc/cron.daily and moved it to a temp folder. But didn't helped!

Thanks in advance!

indeliblestamp 03-18-2009 06:52 AM

Check for a file called .logout in the users' home directory. If its running the slocate update, rename it, remove it, or remove executable permissions from that file.

laurens 03-18-2009 07:07 AM

Quote:

Originally Posted by arungoodboy (Post 3479278)
Check for a file called .logout in the users' home directory. If its running the slocate update, rename it, remove it, or remove executable permissions from that file.

Thanks for the reply but I cannot find anything like that there. By the way, there are like 45 user folders in the home dir...

indeliblestamp 03-18-2009 07:18 AM

Hmm.. I did a quick search and can't seem to find the global equivalent of .logout. Anyway just to clarify, did you check /home/user1/.logout instead of /home/.logout?
Also if this is happening for each shell that is closed, you might also want to check for the existence of something like /home/user1/.bash_logout or /etc/bash.logout.

repo 03-18-2009 07:24 AM

Take a look in
/etc/bash.bashrc

laurens 03-18-2009 07:57 AM

Quote:

Originally Posted by arungoodboy (Post 3479302)
Hmm.. I did a quick search and can't seem to find the global equivalent of .logout. Anyway just to clarify, did you check /home/user1/.logout instead of /home/.logout?
Also if this is happening for each shell that is closed, you might also want to check for the existence of something like /home/user1/.bash_logout or /etc/bash.logout.

Thx for the effort. I found both those files but they contain only these 2 lines:
Code:

# ~/.bash_logout

clear

As for /etc/bashrc it contains this:
Code:

# /etc/bashrc

### thijs wil kleur
alias ls='ls --color=tty'

if [ $UID -gt 99 ] && [ "`id -gn`" = "`id -un`" ]; then
        umask 002
else
        umask 022
fi

# are we an interactive shell?
if [ "$PS1" ]; then
    case $TERM in
        xterm*)
                if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
                        PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
                else
                PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$
                fi
                ;;
        screen)
                if [ -e /etc/sysconfig/bash-prompt-screen ]; then
                        PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
                else
                PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$$
                fi
                ;;
        *)
                [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/et$
            ;;
    esac
    # Turn on checkwinsize
    shopt -s checkwinsize
    [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
fi

if ! shopt -q login_shell ; then # We're not a login shell
        for i in /etc/profile.d/*.sh; do
            if [ -r "$i" ]; then
                . $i
            fi
        done
        unset i
fi
# vim:ts=4:sw=4


kpraveen455 03-18-2009 09:19 AM

I did looked into it and actually I don't know which are all scripts will be executed
when user ends his session (logout)

But nevertheless there should also be some indirect way:
(Correct me if I am wrong!!!)
First we have to know actually which script does this updation? So try to grep the string "updating slocate database" like as shown below:

grep -R "updating slocate database" .

From this try to get which all scripts are trying to do this activity and remove/deactivate those scripts.

Please also let me know if it works!!!

laurens 03-18-2009 10:17 AM

Quote:

Originally Posted by kpraveen455 (Post 3479422)
I did looked into it and actually I don't know which are all scripts will be executed
when user ends his session (logout)

........grep -R "updating slocate database" .

It's executing, yet one hour. I'll let you know
(Maybe there is an option to give the search process absolute priority? to speed it up a little)

SlowCoder 03-18-2009 11:12 AM

Quote:

Originally Posted by laurens (Post 3479496)
It's executing, yet one hour. I'll let you know
(Maybe there is an option to give the search process absolute priority? to speed it up a little)

Check out the 'nice' command. Though I've never used it, I understand that increasing the priority too much could yield a nonresponsive system until the program is finished.

john test 03-18-2009 03:32 PM

Dont know if it will help, but each user on my system as a ".bash_logout"
Code:

cat .bash_logout
# ~/.bash_logout: executed by bash(1) when login shell exits.

# when leaving the console clear the screen to increase privacy

if [ "$SHLVL" = 1 ]; then
    [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
fi

Hope that helps

chrism01 03-19-2009 01:21 AM

Could be in /etc/profile, /etc/bashrc, see also the user's .bashrc, .bash_profile. Could be set as a fn in there. He may also have altered the example in /etc/skel, if there is one.


All times are GMT -5. The time now is 08:29 AM.