Sponsored Content
Top Forums Shell Programming and Scripting Script to eliminate files .rlogin Post 302533716 by nena_redbalon on Friday 24th of June 2011 12:28:09 PM
Old 06-24-2011
Script to eliminate files .rlogin

Hi guys, I'm try making to script for eliminate files rlogins.
Code:
path1='/home/*'
for i in `cat /etc/passwd |awk -F: '{print $6}'`; do
    if test "$i" = "$path1"; then
    echo $i
    cd $i
         if [ -f .rhosts ]; then
               echo "$i/.rhosts detectado"|mail -s "rhosts" root
               rm -f $i/.rhosts
          fi
     fi
done

I want my script only check users with path in /home/*, but the symbol "*" is not working.

As I can do to make the command "test" compare the path "$ i" with a path / home / * (ie / home / all users)

Any suggestions?

Thank!

nena.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

rlogin from Shell script

I am logged into an AIX Unix box. From there I want to remotely login to remotely login to an HP-UX Unix box and want to execute a command that will create a file. I want to get the file to the AIX box. Can someon eplease advise how to automate that in a shell script? At the first step I want to... (2 Replies)
Discussion started by: asutoshch
2 Replies

2. Shell Programming and Scripting

How to Eliminate first line of multiple files

hi gurus ,, I have multiple files with same file pattern..in a particular directory for ex: file20061101.trf file20061102.trf file20061103.trf Each of the file has a header as column names.. My questions is how can i eliminate the first row of each of these... (11 Replies)
Discussion started by: sish78
11 Replies

3. Shell Programming and Scripting

Eliminate variable checking in a script

RH Linux, $SHELL=/bin/ksh I have a .profile which I source in as such --> . .profile Whats happening is the variables are getting validated and generating errors. for example .profile export foo=/to/the/moon when I . .profile , I get : not foundmyusername/.profile or bad... (8 Replies)
Discussion started by: BMetelsky
8 Replies

4. Shell Programming and Scripting

rlogin inside a c-shell script

Hi Forumers, Sorry if it's really simple, but I couldn't find a way out. :( I've to do something like this in a script (csh): <some commands, variable settings, scripts> rlogin different_server <some commands, variable settings, scripts> After "rlogin", it shows the prompt of the... (5 Replies)
Discussion started by: sumitgarg
5 Replies

5. Shell Programming and Scripting

script for nested rlogin and telnet

I want to write a script that rlogins to a couple machines and then from the last machine, telnet into a final machine and execute a command. So in pseudocode it would look like: rlogin host1 from host1 rlogin host2 from host2 telnet host3 from host 3 execute command The reason for the... (6 Replies)
Discussion started by: mcburke38
6 Replies

6. Shell Programming and Scripting

Shell script help to eliminate files of todays date

Hi I am very new to shell scripting and have written a script (below). However the directory I am searching will contain a file with a .trn extension each day which I want to eliminate. Each day the file extension overnight will change to trx, if this fails I want to know. Basically what I... (2 Replies)
Discussion started by: richM
2 Replies

7. Shell Programming and Scripting

script to eliminate left and right fields and to get the ouput.

Hi Experts, I have a file as given below and want to filter out the filenames in it , by deleting left and right filds and to have the fllenames (There are spaces in the filename), Sun Jan 11 11:20:10 2009 1 0 /home/output/file2311_recent.list user1 user2 0 done Sun Jan 11 11:20:10 2009 1 0... (10 Replies)
Discussion started by: rveri
10 Replies

8. Shell Programming and Scripting

rlogin and script

I am writing a script to do rlogin to another system and execute commands on the remote system, i can successfully login to the remote system but the commands are not sent. i can only use rlogin to get to the remote system. what can i do? (6 Replies)
Discussion started by: aydj
6 Replies

9. Shell Programming and Scripting

How to eliminate ^L

Hi, I am trying to create a text file from data retrieved from a query.The data retrieved is having this character '^L' at regular intervals of the data. How can i eliminate this, Please find below the sample data. I tried sed -e "s/\^L//g" to convert it, but with no luck ^LCODE*SERIAL... (11 Replies)
Discussion started by: ramkiran77
11 Replies

10. Shell Programming and Scripting

Need help to eliminate the records

Hi All, Please help me how to remove the records from the file if it is having more number of fields than the required one, before loading into stage Here is the sample records. File is space delimited one chandu 1121324 CC ( 2 spaces) chandu balu 434657 DD (3 spaces) -- failing due to... (10 Replies)
Discussion started by: bbc17484
10 Replies
HOSTS.EQUIV(5)						      BSD File Formats Manual						    HOSTS.EQUIV(5)

NAME
hosts.equiv, .rhosts -- trusted remote hosts and host-user pairs DESCRIPTION
The hosts.equiv and .rhosts files list hosts and users which are ``trusted'' by the local host when a connection is made via rlogind(8), rshd(8), or any other server that uses ruserok(3). This mechanism bypasses password checks, and is required for access via rsh(1). Each line of these files has the format: hostname [username] The hostname may be specified as a host name (typically a fully qualified host name in a DNS environment) or address, +@netgroup (from which only the host names are checked), or a ``+'' wildcard (allow all hosts). The username, if specified, may be given as a user name on the remote host, +@netgroup (from which only the user names are checked), or a ``+'' wildcard (allow all remote users). If a username is specified, only that user from the specified host may login to the local machine. If a username is not specified, any user may login with the same user name. EXAMPLES
somehost A common usage: users on somehost may login to the local host as the same user name. somehost username The user username on somehost may login to the local host. If specified in /etc/hosts.equiv, the user may login with only the same user name. +@anetgroup username The user username may login to the local host from any machine listed in the netgroup anetgroup. + + + Two severe security hazards. In the first case, allows a user on any machine to login to the local host as the same user name. In the second case, allows any user on any machine to login to the local host (as any user, if in /etc/hosts.equiv). WARNINGS
The username checks provided by this mechanism are not secure, as the remote user name is received by the server unchecked for validity. Therefore this mechanism should only be used in an environment where all hosts are completely trusted. A numeric host address instead of a host name can help security considerations somewhat; the address is then used directly by iruserok(3). When a username (or netgroup, or +) is specified in /etc/hosts.equiv, that user (or group of users, or all users, respectively) may login to the local host as any local user. Usernames in /etc/hosts.equiv should therefore be used with extreme caution, or not at all. A .rhosts file must be owned by the user whose home directory it resides in, and must be writable only by that user. Logins as root only check root's .rhosts file; the /etc/hosts.equiv file is not checked for security. Access permitted through root's .rhosts file is typically only for rsh(1), as root must still login on the console for an interactive login such as rlogin(1). FILES
/etc/hosts.equiv Global trusted host-user pairs list ~/.rhosts Per-user trusted host-user pairs list SEE ALSO
rcp(1), rlogin(1), rsh(1), rcmd(3), ruserok(3), netgroup(5) HISTORY
The .rhosts file format appeared in 4.2BSD. BUGS
The ruserok(3) implementation currently skips negative entries (preceded with a ``-'' sign) and does not treat them as ``short-circuit'' neg- ative entries. BSD
November 26, 1997 BSD
All times are GMT -4. The time now is 09:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy