ssh with username and password in the command itselt
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
ssh with username and password in the command itselt
I am using ZOC to automate some work. I want to ssh to a server with a given IP providing the useername and password. I am using the following command.
The command works fine except when password contains '@' sign. how to pass the password in the above command with '@' sign also so the command looks like
What version are you using?
I don't know if this will help, I did a quick search and this caught my eye.
Quote:
ZOC changelog
ZOC 6.34 released Nov 20, 2011 (New Release)
· CHG: ctrl+f in host directory now brings up search dialog
· FIX: possible crash when scrolling
· FIX: possible error importing old hostdirectories
· FIX: quirk in VT220 (when sending f-keys with eightbit-CSI)
· FIX: TN3270 did not allow to enter comma in numeric fields
· FIX: crash when trying to open more than 64 tabs
· FIX: minor quirk in SSH username/password dialog
ZOC 6.33 released Oct 24, 2011 (New Release)
· NEW: support for KOI8-R codepage
· FIX: possible crash when editing SSH tunnels
· FIX: double click to mark word now wraps around line ends
· FIX: minor quirk with quot;send quotedquot; function
· FIX: minor quirk with special characters in passwords in REXX ZocConnect command
· FIX: possible SCP upload problem (truncated file) over DSL connections
· FIX: host directory item's script was not called when doing a reconnect
there is probably not any trouble with ZOC (as it is only a terminal client)
but your server's shell prompt (it can be SH, BASH, KSH)
and you should try to escape (quote) special characters so the shell doesn't interpret them as some vars or something, but a literal character:
- could be that you need this \@:
Code:
"adv:'pass1111\@123'@10.168.1.33" <-- see there \@ in password
Quote:
The special parameters * and @ have special meaning when in double quotes, but you can disable them with the backslash:
echo "*"
echo "\*"
echo "\@"
I think the problem is not with @ sign but with ! sign as after ! sign the password is not read. So how to pass on ! sign in the password field. the single quote and double quote does not help.
I am just going to throw this out there, your intention is a bad practice, from a security standpoint, sending a password as a command line argument is a bad idea.
The most obvious reason being that the shell most likely stores a history of entered commands, viewing that history would reveal your password in plain text.
Another reason, is the password isn't redacted, to hide the password characters (most often with "*"), which means it could easily be shoulder surfed.
I would suggest using public key authentication for ssh connections where entering a password manually isn't possible (ie: via a script).
password is known to all and so password visibility is not my concern. I am just doing health Check of some servers and to login to the server i am using the script to get the output. Then a excel macro is run to get the output in desired format.
Still, the method of passing the password as a parameter is not the thing you should really want.
With ssh-keygen you can create a public/private keypair, and use that to use automated connections. It works without any hassle, even if the password would change for some obscure reason or another. You'd help yourself greatly to use the regular solutions unless such things are not possible at all...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.