Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
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
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!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.