HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Scripting for rhosts format
Operating System - HP-UX
1836633
Members
1693
Online
110102
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2005 04:56 PM
01-25-2005 04:56 PM
Hi All,
I want to create a script to generate a neat report for my all rhosts file. For instance, I have a rhosts file as below :
#cat /root/.rhosts
bdhp4337.na.pg.com root
192.44.190.109 root
rshj root # 03152004:RSHJ reporting tool:paul@test.com:NEVER:john@test.com
bdhp4259 root # 03172004:NP1 database server:paul@test.com:NEVER:john@test.com
and I want to generate a report with format as below :
Remote server UserID Justification
-------------------------------------------------------
bdhp4337 root
192.44.190.109 root
rshj root # 03152004:RSHJ reporting tool:paul@test.com:NEVER:john@test.com
bdhp4259 root # 03172004:NP1 database server:paul@test.com:NEVER:john@test.com
How can I do that using a shell scripting?
Pls help. High score will be given.
Best Regards,
Dewa
I want to create a script to generate a neat report for my all rhosts file. For instance, I have a rhosts file as below :
#cat /root/.rhosts
bdhp4337.na.pg.com root
192.44.190.109 root
rshj root # 03152004:RSHJ reporting tool:paul@test.com:NEVER:john@test.com
bdhp4259 root # 03172004:NP1 database server:paul@test.com:NEVER:john@test.com
and I want to generate a report with format as below :
Remote server UserID Justification
-------------------------------------------------------
bdhp4337 root
192.44.190.109 root
rshj root # 03152004:RSHJ reporting tool:paul@test.com:NEVER:john@test.com
bdhp4259 root # 03172004:NP1 database server:paul@test.com:NEVER:john@test.com
How can I do that using a shell scripting?
Pls help. High score will be given.
Best Regards,
Dewa
Santos
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2005 05:01 PM
01-25-2005 05:01 PM
Re: Scripting for rhosts format
Hi, Sorry...the attached output is not so clear.
The format should be :
Remote server UserID Justification
bdhp4337 root
192.44.190.109 root
rshj root # 03152004:...
bdhp4259 root # 03172004:...
The format should be :
Remote server UserID Justification
bdhp4337 root
192.44.190.109 root
rshj root # 03152004:...
bdhp4259 root # 03172004:...
Santos
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2005 06:02 PM
01-25-2005 06:02 PM
Re: Scripting for rhosts format
Hi Dewa
.rhosts file is setting permission for rcp (remote copy).
It is hard to understand for me.
If you want to create script copy file from serverA to serverB.
On serverB edit ~.rhosts file
#vi ~.rhosts
serverA root
at serverA:
#rcp -r -p /path/file_or_dir serverB:/path/
HTH
tienna
.rhosts file is setting permission for rcp (remote copy).
It is hard to understand for me.
If you want to create script copy file from serverA to serverB.
On serverB edit ~.rhosts file
#vi ~.rhosts
serverA root
at serverA:
#rcp -r -p /path/file_or_dir serverB:/path/
HTH
tienna
HP is simple
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2005 06:52 PM
01-25-2005 06:52 PM
Solution
Hi Dewa
If I understand correctly (I hope I do!) try this:
#!/bin/ksh
echo "HOST\tUSER\tCOMMENT" >/tmp/report
cat /root/.rhosts | while read HOST USER COMM
do
COMMENT=`echo $COMM | sed 's/ /_/g'`
echo "$HOST\t$USER\t$COMMENT" >>/tmp/report
done
cat /tmp/report | pr -e15
Note:- We have to pump the comment field through 'sed' to get rid of the spaces. This would cause the output to look strange. You may need to scroll-up to view the output as 'pr' paginates the file.
Best regards - Keith
If I understand correctly (I hope I do!) try this:
#!/bin/ksh
echo "HOST\tUSER\tCOMMENT" >/tmp/report
cat /root/.rhosts | while read HOST USER COMM
do
COMMENT=`echo $COMM | sed 's/ /_/g'`
echo "$HOST\t$USER\t$COMMENT" >>/tmp/report
done
cat /tmp/report | pr -e15
Note:- We have to pump the comment field through 'sed' to get rid of the spaces. This would cause the output to look strange. You may need to scroll-up to view the output as 'pr' paginates the file.
Best regards - Keith
Arse-cover at all costs
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP