Operating System - HP-UX
1847072 Members
5351 Online
110262 Solutions
New Discussion

Re: Identifying scripts using remsh

 
SOLVED
Go to solution
Berd
Trusted Contributor

Identifying scripts using remsh

I am starting upon a process to replace remsh with ssh. I have gone through a process of provate and public key generation, and have copied these across to hosts as necessary.

I'm now trying to locate all scripts that make use of remsh so I can edit them. Has anyone found a clever of way of locating all scripts.

I am worried that I will shutdown 'r' services but then find I have missed a script.

Berd
5 REPLIES 5
Pete Randall
Outstanding Contributor

Re: Identifying scripts using remsh

You can use the find command:

find /starting_directory -type f -exec grep -l "remsh" {} \;


Pete

Pete
James R. Ferguson
Acclaimed Contributor
Solution

Re: Identifying scripts using remsh

Hi Berd:

I'd use 'find' and 'grep' for "remsh".

Keep your 'find' from crossing mountpoints with '-xdev'. This is very useful if you search the root ('/') directory. Afterall, you *want* to search '/sbin' and '/etc/' but don't want nor need to traverse '/var' or '/tmp'.

The following shell script limits examination to text files eliminating searching binary ones:

# cat .finder
#!/usr/bin/sh
typeset DIR=$1
typeset PAT=$2
find ${DIR} -xdev -type f | while read FILE
do
[ `file ${FILE} | grep -c ascii` -eq 0 ] && continue
grep "$PAT" ${FILE} /dev/null
done
exit 0

...run as:

# ./finder /path_to_search pattern_to_find

for example:

# ./finder / remsh

Regards!

...JRF...
Yogeeraj_1
Honored Contributor

Re: Identifying scripts using remsh

hi,

One good way would be to go to each directory where you keep your scripts and do a:

grep -i remsh *.sh



otherwise, you can just go to all the other hosts and run:

last | grep rmeshd

though this does not give you the name of the script, you will know that there are still scripts that have been left out!


hope this helps!

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Peter Godron
Honored Contributor

Re: Identifying scripts using remsh

Berd,
check the wtmp log file (last | grep remshd) then concentrate on those users and times of access.
Or you could try to get the daemon to log access. Look at /etc/inetd.conf.
Berd
Trusted Contributor

Re: Identifying scripts using remsh

Thanks for the input everyone.

I think I will use the find command with the xdev flag. I'll work on one mount point at a time per host.

Cheers,
Berd