Entering password in script for ftp/sftp and telnet/ssh ?
-
fdurante
Entering password in script for ftp/sftp and telnet/ssh ?
I would to add in my bash script ftp/sftp and telnet/ssh commands to transfer files from 1 OXE to a remote OXE automatically, and everytime I have to enter password manually !
I ask my colleague about this problem and he told me to use "expect" but the module for this is not installed on OXE R7.1 (F5.401.27 Alcatel patch ). Do you have another solution ?
Is it possible to install the module for "expect" on Linux of OXE CS ?
And, then, how can I use expect for my password problem ?
Thank you in advance for your response !
I ask my colleague about this problem and he told me to use "expect" but the module for this is not installed on OXE R7.1 (F5.401.27 Alcatel patch ). Do you have another solution ?
Is it possible to install the module for "expect" on Linux of OXE CS ?
And, then, how can I use expect for my password problem ?
Thank you in advance for your response !
-
krzysioD
Re: Entering password in script for ftp/sftp and telnet/ssh ?
Very good colleague. Much knowleage. Expect for OXE (as lftp, zmodem, minicom, midnight commander, etc could be found and installed, just search for my posts about Mandrake 7.2 and archive ftp site. I think that i've olso put an Expect tool on this forum).I ask my colleague about this problem and he told me to use "expect" but the module for this is not installed on OXE R7.1 (F5.401.27 Alcatel patch ).
For example good unix book and redirection.Do you have another solution ?
note:
Code: Select all
#cat << EOF | ftp -r 3 -P 65521 -a -v ftp://mtcl:xyz1@191.254.1.2
#asc
#put import.txt
#EOF
- 3 times Retry
- use Port 65521
- be Verbose
- use ASCii mode for txt files
- send file named import.txt
Just an example (OXE R8.0.1 to Windows server, should work on OXE from R5 to R9).
-
Gedeon
Re: Entering password in script for ftp/sftp and telnet/ssh ?
for ftp, you can use .netrc in login directory (see google for more explanations).
for ssh, you can use -l for specifie login, but for password I have no solution except expect or ssh key
for scp, you can specifie URL like scp MyFile user:password@hostname:/My/Path/to/the/file
G.
for ssh, you can use -l for specifie login, but for password I have no solution except expect or ssh key
for scp, you can specifie URL like scp MyFile user:password@hostname:/My/Path/to/the/file
G.
-
krzysioD
Re: Entering password in script for ftp/sftp and telnet/ssh ?
Well, you could use .rhost / /etc/host.equiv
if you really know what you are doing
if you really know what you are doing
-
fdurante
Re: Entering password in script for ftp/sftp and telnet/ssh ?
Thank you for your responses !
I need to use for my script :
ssh -> you told me that there is no solution except expect or ssh key. I think you talk about rsa keys public. What's the procedure to use this ? What kind of lines can I insert in my script to use this solution ?
telnet -> how can I enter the password in my script automatically ? Do I have to use expect too ?
sftp -> you told me with scp MyFile user:password@hostname:/My/Path/to/the/file, it's working -> I will check
ftp -> you told me that .netrc in login directory is OK. Is there another solution with a simple line as sftp (scp)
krzysioD, I don't find Expect tool on the forum. Do you have a link to download package which includes "expect" ?
Thank you in advance for your responses !
I need to use for my script :
ssh -> you told me that there is no solution except expect or ssh key. I think you talk about rsa keys public. What's the procedure to use this ? What kind of lines can I insert in my script to use this solution ?
telnet -> how can I enter the password in my script automatically ? Do I have to use expect too ?
sftp -> you told me with scp MyFile user:password@hostname:/My/Path/to/the/file, it's working -> I will check
ftp -> you told me that .netrc in login directory is OK. Is there another solution with a simple line as sftp (scp)
krzysioD, I don't find Expect tool on the forum. Do you have a link to download package which includes "expect" ?
Thank you in advance for your responses !
-
krzysioD
Re: Entering password in script for ftp/sftp and telnet/ssh ?
Explanation could be found in every good google-like page, see (example)fdurante wrote:Thank you for your responses !
I need to use for my script :
ssh -> you told me that there is no solution except expect or ssh key. I think you talk about rsa keys public. What's the procedure to use this ? What kind of lines can I insert in my script to use this solution ?
1) http://rcsg-gsir.imsb-dsgi.nrc-cnrc.gc. ... ode31.html
2) http://www.cs.toronto.edu/~murray/compn ... s_ssh.html
3) http://www.debian-administration.org/articles/152
Just 1st page of google for "ssh passwordless login".
Note: on omnipcx OXE you got SSH version 1 (implemented by very popular openssh implementation).
In many modern unixes you have version 2nd. (So remember this while reading above texts).
Without en expect i don't see how. But well... i've shown you how to use FTP, without expect, use the force luke!fdurante wrote: telnet -> how can I enter the password in my script automatically ? Do I have to use expect too ?
If you got SSH don't use Telnet. Same with SFTP.fdurante wrote: sftp -> you told me with scp MyFile user:password@hostname:/My/Path/to/the/file, it's working -> I will check
ftp -> you told me that .netrc in login directory is OK. Is there another solution with a simple line as sftp (scp)
BTW: if you use ssh login based on keys, well you don't need to enter scp passwords...
S is for Secure, So Secure Shell, Secure FTP.
Search Mandrake 7.2 with TCL/TK packages. (rpm files). Just don't have time to track down very FTP sites with very old linux releases. Huh, my favorite one (SunSite) does not have this old stuff, will go for some old CD magazines when i got some spare time.fdurante wrote: krzysioD, I don't find Expect tool on the forum. Do you have a link to download package which includes "expect" ?
Thank you in advance for your responses !
Anyone interested in hosting FTP server with old Mandrake? (basesystem for OXE R5-R9)
-
pilotrus
Re: Entering password in script for ftp/sftp and telnet/ssh ?
We use rlogin via mtcl account on OXE.
It is in standard tool of OXE. It is used in pcscopy.
It is in standard tool of OXE. It is used in pcscopy.
-
krzysioD
Re: Entering password in script for ftp/sftp and telnet/ssh ?
r* tools like rlogin, rsh, rcp etc... are dead for me as they don't crypt.
Also level of auth is IP-only, if someone has any ip-knowleage and access to swith, you are sitting duck waiting for a shot.

Also level of auth is IP-only, if someone has any ip-knowleage and access to swith, you are sitting duck waiting for a shot.

-
pilotrus
Re: Entering password in script for ftp/sftp and telnet/ssh ?
There are more other methods to keep security.
And approach to security problem have to be more complex.
And approach to security problem have to be more complex.
-
fedoseevka_DUP
Re: Entering password in script for ftp/sftp and telnet/ssh ?
SecureCRT scripts
#$language = "VBScript"
#$interface = "1.0"
Sub main
' turn on synchronous mode so we don't miss any data
crt.Screen.Synchronous = True
' Wait for a string that looks like "login: " or "Login: "
' Occasionally, a host needs to be kicked to display a
' login prompt.
If (Not crt.Screen.WaitForString("ogin: ", 5)) Then
crt.Screen.Send vbCr
crt.Screen.WaitForString "ogin: "
End If
' Send your username followed by a carriage return
crt.Screen.Send "mylogin" & VbCr
' Wait for a tring that looks like "password: " or "Password: "
crt.Screen.WaitForString "assword:"
' Send your password followed by a carriage return
crt.Screen.Send "mypassword" & VbCr
' turn off synchronous mode for normal input processing
crt.Screen.Synchronous = False
End Sub
#$language = "VBScript"
#$interface = "1.0"
Sub main
Dim passwd
' turn on synchronous mode so we don't miss any data
crt.Screen.Synchronous = True
' Wait for a string that looks like "login: " or "Login: "
crt.Screen.WaitForString "ogin: "
' Send your username followed by a carriage return
crt.Screen.Send "mylogin" & VbCr
' Wait for a tring that looks like "password: " or "Password: "
crt.Screen.WaitForString "assword:"
' prompt the user for a password
passwd = crt.Dialog.Prompt("Please enter your password:", "Enter Password", "", True)
' send the password and a carriage return
crt.Screen.Send passwd & VbCr
' turn off synchronous mode to restore normal input processing
crt.Screen.Synchronous = False
End Sub
#$language = "VBScript"
#$interface = "1.0"
Sub main
' turn on synchronous mode so we don't miss any data
crt.Screen.Synchronous = True
' Wait for a string that looks like "login: " or "Login: "
crt.Screen.WaitForString "ogin: "
' Send your username followed by a carriage return
crt.Screen.Send "mylogin" & VbCr
' Wait for a tring that looks like "password: " or "Password: "
crt.Screen.WaitForString "assword:"
' Send your password followed by a carriage return
crt.Screen.Send "mypassword" & VbCr
' turn off synchronous mode to restore normal input processing
crt.Screen.Synchronous = False
End Sub
#$language = "VBScript"
#$interface = "1.0"
Sub main
' turn on synchronous mode so we don't miss any data
crt.Screen.Synchronous = True
' Wait for a string that looks like "login: " or "Login: "
' Occasionally, a host needs to be kicked to display a
' login prompt.
If (Not crt.Screen.WaitForString("ogin: ", 5)) Then
crt.Screen.Send vbCr
crt.Screen.WaitForString "ogin: "
End If
' Send your username followed by a carriage return
crt.Screen.Send "mylogin" & VbCr
' Wait for a tring that looks like "password: " or "Password: "
crt.Screen.WaitForString "assword:"
' Send your password followed by a carriage return
crt.Screen.Send "mypassword" & VbCr
' turn off synchronous mode for normal input processing
crt.Screen.Synchronous = False
End Sub
#$language = "VBScript"
#$interface = "1.0"
Sub main
Dim passwd
' turn on synchronous mode so we don't miss any data
crt.Screen.Synchronous = True
' Wait for a string that looks like "login: " or "Login: "
crt.Screen.WaitForString "ogin: "
' Send your username followed by a carriage return
crt.Screen.Send "mylogin" & VbCr
' Wait for a tring that looks like "password: " or "Password: "
crt.Screen.WaitForString "assword:"
' prompt the user for a password
passwd = crt.Dialog.Prompt("Please enter your password:", "Enter Password", "", True)
' send the password and a carriage return
crt.Screen.Send passwd & VbCr
' turn off synchronous mode to restore normal input processing
crt.Screen.Synchronous = False
End Sub
#$language = "VBScript"
#$interface = "1.0"
Sub main
' turn on synchronous mode so we don't miss any data
crt.Screen.Synchronous = True
' Wait for a string that looks like "login: " or "Login: "
crt.Screen.WaitForString "ogin: "
' Send your username followed by a carriage return
crt.Screen.Send "mylogin" & VbCr
' Wait for a tring that looks like "password: " or "Password: "
crt.Screen.WaitForString "assword:"
' Send your password followed by a carriage return
crt.Screen.Send "mypassword" & VbCr
' turn off synchronous mode to restore normal input processing
crt.Screen.Synchronous = False
End Sub
