Looking for a linux shell command.
Hi.
I'm looking for a specific command,if it exist... i want to login from my server to another linux server,but the question is: can i doit in a one line command for ex: usually you type: ssh "user"@10.1.1.1 and then the password,but i'm looking for a command in one line a fake ex: ssh user@10.1.1.1 -p "password" something like that. I don't know if anyone of you understand what do i want to say ..my english is so..bad:) |
Nope. The ssh command by its nature does not permit to send the password in clear text. What you're looking for is a password-less connection to the remote server, right? In this case you have to set up the public key authentication method. There are a lot of documents online that explain how to do that. Here is an example by Red Hat docs: http://docs.redhat.com/docs/en-US/Re...-keypairs.html
|
Expect
I figure that you could do that with expect, but expect scripting is insecure for this purpose.
colucix issued the right response for this issue. I would like to elaborate: - issue "ssh-keygen" on the "client"; - the previous command, once execute successfully will create a file in your home directory (/home/user/.ssh/id_rsa.pub); - copy the contents of that file to the "server" in /home/user/.ssh/authorized_keys; - if both the client and the server are using the default ssh configurations, you should be able to connect from the client to the server without using a password. |
The summary from darku is nice, except for a detail: the ssh-keygen command creates the keys into the current working directory. You have to change to $HOME/.ssh before running the command.
|
I think it is utterly dependent on the distribution. Both Debian, Ubuntu and, if I am not mistaken CentOS currently deploy the keys to ~/.ssh if not directed otherwise.
Not trying to start a flame war, just writing from memory right now. Anyway, tomorrow I will have to gently shake my Ubuntu "sort of" 11.04 into working order so, I am off to bed. |
You're right!! Sorry, my mistake. I tried both on recent releases of CentOS and OpenSuSE and it defaults to id_rsa under the .ssh directory. Maybe I've always created my keys using the -f option to give them a unique name, then I've moved them to the .ssh dir. I stand corrected! :)
|
Quote:
Code:
ssh-copy-id -i pubkeyfile [user@]servername |
All times are GMT -5. The time now is 07:03 AM. |