Hello,
How I can pass username and password as an argument when I telnet or
rlogin to a machine to avoid user interaction.
Thanks,
Velmurugan G
|
|
-1
|
|
|
|
Reply
|
gvelmurugan (40)
|
10/7/2005 11:17:55 AM |
|
Hello,
You can put the machine name, username and password in the .netrc file
and the execute the rlogin command like this :
rlogin -l <user name> <hostname>
Regards,
Thobias
gvelmurugan@gmail.com wrote:
>Hello,
>
>How I can pass username and password as an argument when I telnet or
>rlogin to a machine to avoid user interaction.
>
>Thanks,
>
>Velmurugan G
>
>
>
--
Thobias Vakayil
Alcatel Development India (ADI)
PH: 2349961/72/86 EXTN :7018
|
|
0
|
|
|
|
Reply
|
Thobias
|
10/7/2005 11:29:55 AM
|
|
Hello Thobias,
I have tried this but it is asking for password.
What I have did is, in root's home directory:
# vi .netrc
<hostname> root <passsword>
#rlogin -l root <hostname>
password:
Any more suggestion.
Thanks
Velmurugan G
|
|
0
|
|
|
|
Reply
|
gvelmurugan
|
10/7/2005 12:06:12 PM
|
|
Thobias Vakayil <Vakayil.Thobias@alcatel.com> wrote:
> gvelmurugan@gmail.com wrote:
>>How I can pass username and password as an argument when I telnet or
>>rlogin to a machine to avoid user interaction.
>
> You can put the machine name, username and password in the .netrc file
> and the execute the rlogin command like this :
> rlogin -l <user name> <hostname>
I guess you haven't actually tested that ? From `man netrc`:
The .netrc file contains data for logging in to a remote
host over the network for file transfers by ftp(1).
To the OP - use ssh instead. If you think you can't use ssh, re-think.
If you *still* think that ssh is absolutely no alternative, take a
look at expect ( http://expect.nist.gov/ ).
mp.
--
Systems Administrator | Institute of Scientific Computing | Univ. of Vienna
|
|
0
|
|
|
|
Reply
|
Martin
|
10/7/2005 12:22:25 PM
|
|
Is that your wanted to automate some procedures that require telnet to other
server and run some commands? If so, you can use an "expect" script (expect
is an command interrupters (like perl, awk ... etc.) using TCL language).
Regards,
Henry
"Thobias Vakayil" <Vakayil.Thobias@alcatel.com> wrote in message
news:1128685136.826734@slbhw0...
> Hello,
>
> You can put the machine name, username and password in the .netrc file and
> the execute the rlogin command like this :
> rlogin -l <user name> <hostname>
>
> Regards,
> Thobias
> gvelmurugan@gmail.com wrote:
>
>>Hello,
>>
>>How I can pass username and password as an argument when I telnet or
>>rlogin to a machine to avoid user interaction.
>>
>>Thanks,
>>
>>Velmurugan G
>>
>>
>
>
> --
> Thobias Vakayil
> Alcatel Development India (ADI)
> PH: 2349961/72/86 EXTN :7018
|
|
1
|
|
|
|
Reply
|
kaming
|
10/7/2005 12:26:09 PM
|
|
<gvelmurugan@gmail.com> wrote in message
news:1128683875.827621.284380@g47g2000cwa.googlegroups.com...
> Hello,
>
> How I can pass username and password as an argument when I telnet or
> rlogin to a machine to avoid user interaction.
>
> Thanks,
>
> Velmurugan G
>
You should really look into using ssh/ssh-agent/+keys
--
Rodrick R. Brown
http://www.rodrickbrown.com
|
|
0
|
|
|
|
Reply
|
Rodrick
|
10/7/2005 12:30:44 PM
|
|
Thobias Vakayil <Vakayil.Thobias@alcatel.com> wrote:
> Hello,
>
> You can put the machine name, username and password in the .netrc file
> and the execute the rlogin command like this :
> rlogin -l <user name> <hostname>
..netrc is for ftp, you have to edit .rhosts
But don't do this. Instead use ssh with public/private keypair.
Suppose you want to login from host A to host B:
- On host A create a ssh keypair:
ssh-keygen -t dsa -N "" -f $HOME/.ssh/id_dsa
- Copy (or append) the contents of $HOME/.ssh/id_dsa.pub from host A to
$HOME/.ssh/authorized_keys on host B:
scp $HOME/.ssh/id_dsa.pub USER@HOST-B:.ssh/authorized_keys
(copy)
ssh USER@HOST-B "cat >> .ssh/authorized_keys" < $HOME/.ssh/id_dsa.pub
(append)
Make sure the $HOME/.ssh directory exists on host B and has permissions 700.
- If you want a passwordless root-login you have to enable direct root-logins
via ssh. On Host B edit /etc/ssh/sshd_config and change the relevant line to
PermitRootLogin no
or
PermitRootLogin without-password
For details read the manual page sshd_config(4).
Then restart the ssh daemon:
svcadm restart ssh (Solaris 10)
or
/etc/init.d/sshd stop; /etc/init.d/sshd start (Solaris 9)
--
Daniel
|
|
0
|
|
|
|
Reply
|
Daniel
|
10/7/2005 12:35:53 PM
|
|
Hello Daniel,
yep .netrc is for ftp, anyhow thanks for the tips Thobias. SSH sounds
good, but is there is anyway to pass username and password as a
parameter for telnet or rlogin without interaction of user. I dont
wanna edit .rhosts.
Thanks,
Velmurugan G
|
|
0
|
|
|
|
Reply
|
gvelmurugan
|
10/7/2005 12:52:07 PM
|
|
gvelmurugan@gmail.com wrote:
> Hello Daniel,
>
> yep .netrc is for ftp, anyhow thanks for the tips Thobias. SSH sounds
> good, but is there is anyway to pass username and password as a
> parameter for telnet or rlogin without interaction of user. I dont
> wanna edit .rhosts.
>
> Thanks,
>
> Velmurugan G
http://steve-parker.org/sh/hints.shtml
|
|
0
|
|
|
|
Reply
|
Edward
|
10/7/2005 12:59:24 PM
|
|
"gvelmurugan@gmail.com" <gvelmurugan@gmail.com> writes:
>Hello,
>
>How I can pass username and password as an argument when I telnet or
>rlogin to a machine to avoid user interaction.
You don't. You use SSH.
--
"Other people are not your property."
[email me at huge [at] huge [dot] org [dot] uk]
|
|
0
|
|
|
|
Reply
|
huge
|
10/8/2005 9:47:47 AM
|
|
Hello Edward,
I have tried this site " http://steve-parker.org/sh/hints.shtml " and
came across one script.
telnet1.sh :
#!/bin/sh
host=sunfi75
port=23
login=root
passwd=Gan@Kri
cmd="ls /tmp"
echo open ${host} ${port}
sleep 1
echo ${login}
sleep 1
echo ${passwd}
sleep 1
echo ${cmd}
sleep 1
echo exit
#telnet1.sh | telnet
It is working fine and what the problem is, it exits after 1 second
even when I commented out the line.
..............
............
#echo exit
..............
Any suggestion ?
Thanks,
Velmurugan G
|
|
1
|
|
|
|
Reply
|
gvelmurugan
|
10/8/2005 12:59:47 PM
|
|
Hello Edward,
I have tried this site " http://steve-parker.org/sh/hints.shtml " and
came across one script.
telnet1.sh :
#!/bin/sh
host=sunfi75
port=23
login=root
passwd=Gan@Kri
cmd="ls /tmp"
echo open ${host} ${port}
sleep 1
echo ${login}
sleep 1
echo ${passwd}
sleep 1
echo ${cmd}
sleep 1
echo exit
#telnet1.sh | telnet
It is working fine and what the problem is, it exits after 1 second
even when I commented out the line.
..............
............
#echo exit
..............
Any suggestion ?
Thanks,
Velmurugan G
|
|
0
|
|
|
|
Reply
|
gvelmurugan
|
10/8/2005 1:20:25 PM
|
|
On Sat, 08 Oct 2005 05:59:47 -0700, gvelmurugan@gmail.com wrote:
> Hello Edward,
>
> I have tried this site " http://steve-parker.org/sh/hints.shtml " and came
> across one script.
>
> telnet1.sh :
>
> #!/bin/sh
> host=sunfi75
> port=23
> login=root
> passwd=Gan@Kri
> cmd="ls /tmp"
>
> echo open ${host} ${port}
> sleep 1
> echo ${login}
> sleep 1
> echo ${passwd}
> sleep 1
> echo ${cmd}
> sleep 1
> echo exit
>
>
> #telnet1.sh | telnet
>
> It is working fine and what the problem is, it exits after 1 second even
> when I commented out the line.
> .............
> ...........
> #echo exit
> .............
>
> Any suggestion ?
>
>
Yes, do as huge suggests and use ssh
:-)
Or, if you really really really want to use telnet, use expect
--
Bruce
"The internet is a huge and diverse community and
not every one is friendly"
http://www.ytc1.co.uk
|
|
0
|
|
|
|
Reply
|
Bruce
|
10/8/2005 1:53:32 PM
|
|
gvelmurugan@gmail.com wrote:
> I have tried this site " http://steve-parker.org/sh/hints.shtml " and
> came across one script.
>
> telnet1.sh :
>
> #!/bin/sh
> host=sunfi75
> port=23
> login=root
> passwd=Gan@Kri
> cmd="ls /tmp"
>
> echo open ${host} ${port}
> sleep 1
> echo ${login}
> sleep 1
> echo ${passwd}
> sleep 1
> echo ${cmd}
> sleep 1
> echo exit
>
>
> #telnet1.sh | telnet
>
> It is working fine and what the problem is, it exits after 1 second
> even when I commented out the line.
> .............
> ...........
> #echo exit
> .............
If it exits not matter what you do, and if you want it not to exit,
then how does that qualify as "working fine"?
The fact of the matter is, it is not working fine, and there is no
way to modify this script to do what you want. As soon as the script
exits, telnet will get an end-of-file on its standard input, and it
will close the connection and exit. There is no way to modify the
script to provide an *interactive* login session.
> Any suggestion ?
Yes, use ssh. telnet does not have the feature you want.
- Logan
|
|
0
|
|
|
|
Reply
|
Logan
|
10/8/2005 4:05:17 PM
|
|
Most of people know abt ssh and its Automation. There are few case u cant modify a remote server authentication file, so u need a way to pass your username and password while write a non user interactive one script. instead of suggesting a way for that you guys only say ssh and all abt its authentication. All know that, say something if you know more.
--
|
|
0
|
|
|
|
Reply
|
rudrasamal (1)
|
8/17/2012 8:02:27 PM
|
|
On 18/08/2012 6:02 AM, rudrasamal wrote:
> Most of people know abt ssh and its Automation. There are few case u cant modify a remote server authentication file, so u need a way to pass your username and password while write a non user interactive one script. instead of suggesting a way for that you guys only say ssh and all abt its authentication. All know that, say something if you know more.
>
> --http://compgroups.net/comp.unix.solaris/how-to-pass-user-name-and-password-when-tel/40654
>
>
I *think* the answer to what you are asking is "expect"[1], but I could
be wrong, either in that you are actually asking a question or what it
is about.
Cheers,
Gary B-)
1 - here: <http://expect.sourceforge.net/>
--
When men talk to their friends, they insult each other.
They don't really mean it.
When women talk to their friends, they compliment each other.
They don't mean it either.
|
|
0
|
|
|
|
Reply
|
grschmidt (100)
|
8/18/2012 12:40:45 AM
|
|
hi,
On 08/17/12 10:02 PM, rudrasamal wrote:
> Most of people know abt ssh and its Automation. There are few case u cant modify a remote server authentication file, so u need a way to pass your username and password while write a non user interactive one script. instead of suggesting a way for that you guys only say ssh and all abt its authentication. All know that, say something if you know more.
>
> --http://compgroups.net/comp.unix.solaris/how-to-pass-user-name-and-password-when-tel/40654
>
>
I use expect for such things, its perfect!
/michael
|
|
0
|
|
|
|
Reply
|
michael_laajanen (637)
|
8/18/2012 6:24:27 PM
|
|
|
16 Replies
4873 Views
(page loaded in 0.03 seconds)
|