- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Replace .netrc file
Operating System - HP-UX
1823077
Members
3411
Online
109645
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
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
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
тАО08-18-2005 04:46 PM
тАО08-18-2005 04:46 PM
Hi All,
I have a FTP script that is using .netrc file. I do not want to use .netrc file anymore because of security reasons and want to replace the FTP script with using sftp or scp since the boxes have been installed SSH. Below is the .netrc file and FTP command taken from the FTP script.
[root@SERV_01:/home/ARPSIOA]
# more .netrc
machine SERV_02
login aigposda
password aigpos01
macdef filetransfer
cd $1
bin
put $2
chmod 644 $2
put $3
chmod 644 $3
quit
FTP command taken from the script :
echo "\$ filetransfer ${GPOS_IN_DIR} 793_oc_${TIME_ST}.stop 793_od_${TIME_ST}.stop " | ftp ${GPOS_SER_NM}
Pls Note that FTP command above is using some variabels.
What kind of sftp or scp commands can I use to replace the FTP command above? Can we use sftp or scp command with some varibles as well?
Please help. High score will be given.
Thanks alot in advance.
Best Regards,
Dewa
I have a FTP script that is using .netrc file. I do not want to use .netrc file anymore because of security reasons and want to replace the FTP script with using sftp or scp since the boxes have been installed SSH. Below is the .netrc file and FTP command taken from the FTP script.
[root@SERV_01:/home/ARPSIOA]
# more .netrc
machine SERV_02
login aigposda
password aigpos01
macdef filetransfer
cd $1
bin
put $2
chmod 644 $2
put $3
chmod 644 $3
quit
FTP command taken from the script :
echo "\$ filetransfer ${GPOS_IN_DIR} 793_oc_${TIME_ST}.stop 793_od_${TIME_ST}.stop " | ftp ${GPOS_SER_NM}
Pls Note that FTP command above is using some variabels.
What kind of sftp or scp commands can I use to replace the FTP command above? Can we use sftp or scp command with some varibles as well?
Please help. High score will be given.
Thanks alot in advance.
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
тАО08-18-2005 05:29 PM
тАО08-18-2005 05:29 PM
Solution
If you use scp which is very simple and easy to configure. Also since it uses encrypted channel its more secure and if you use it with the certificate keys you dont need to provide the password.
Here is how it works...
On the client machine, generate the public keys using ssh-keygen command and once you have the public key with the extension .pub copy that to the server (remote host running sshd) in the home directory of the user create a file called authorized_keys in ~user/.ssh directory and put the content of the .pub file in it.
By and change the mode of the file to 600.
By doing this you can test by loging in using ssh, it wont ask for the password.
And its now you can write a script to scp your files without the worry of password.
Here is how it works...
On the client machine, generate the public keys using ssh-keygen command and once you have the public key with the extension .pub copy that to the server (remote host running sshd) in the home directory of the user create a file called authorized_keys in ~user/.ssh directory and put the content of the .pub file in it.
By and change the mode of the file to 600.
By doing this you can test by loging in using ssh
And its now you can write a script to scp your files without the worry of password.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-18-2005 05:31 PM
тАО08-18-2005 05:31 PM
Re: Replace .netrc file
For scp and sftp you have to setup key sharing between machines or use expect scripting to do it easily.
You can use variable substition in sftp and scp also. All utility will be coming under SHELL. If you make shell variables then it will be applicable to the present shell globally.
You can try it as,
REM_USER="root"
REM_HOST="remote"
REM_LOCATION="/tmp"
LOCAL_LOC="/tmp/test"
scp ${REM_USER}@${REM_HOST}:${REM_LOCATION} ${LOCAL_LOC}
hth.
You can use variable substition in sftp and scp also. All utility will be coming under SHELL. If you make shell variables then it will be applicable to the present shell globally.
You can try it as,
REM_USER="root"
REM_HOST="remote"
REM_LOCATION="/tmp"
LOCAL_LOC="/tmp/test"
scp ${REM_USER}@${REM_HOST}:${REM_LOCATION} ${LOCAL_LOC}
hth.
Easy to suggest when don't know about the problem!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-18-2005 07:00 PM
тАО08-18-2005 07:00 PM
Re: Replace .netrc file
Hi All,
Got it. Thanks alot for your help.
Best Regards,
Dewa
Got it. Thanks alot for your help.
Best Regards,
Dewa
Santos
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
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP