LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   ssh to server without password and without changing the server's setup (https://www.linuxquestions.org/questions/linux-networking-3/ssh-to-server-without-password-and-without-changing-the-servers-setup-4175433686/)

alex170872 10-23-2012 10:12 AM

ssh to server without password and without changing the server's setup
 
Hi,

this question is related to ssh into a server without password. I know, the usual way to accomplish this is to exchange public keys, which gets stored on the server. But I want to be able to log-in to the server without making changes to the server, i.e. to store the key in .ssh/authorized_keys or something.

Is there any other way this can be accomplished?


Thanks,
Alex

pingu 10-23-2012 11:07 AM

No.
Unless the server accepts passwordless accounts & ssh logins - which I really hope it doesn't!

What you're asking is actually "is there a way I can set up my server so that anybody in the whole world can login".
Why do you want to do this?

alex170872 10-23-2012 11:18 AM

Hi,

I do not want anybody in the whole world to login to the machine - I was just wondering if there is some other way I could authenticate myself.

Instead of typing the password for each ssh connection, I hoped for a way of providing this authorization information, maybe in some kind of file which contains an encrypted version of the password. A kind of private key, which can be used to automate the authorization process.

Is there no such way to handle ssh without installing/copying a public key to the server?


Thanks
Alex

pingu 10-23-2012 11:27 AM

Aha, now I understand!
I don't know of any way to pass a password to the ssh prompt, maybe with some serious scripting?

Reuti 10-24-2012 05:31 AM

Somehow you need to authenticate yourself. So something has to be done on the server to grant access to someone. If you don’t want it on a per user basis: hostbased authentication may be an option. But this would also me to setup something on the server.

Maybe you can layout the intended use in more detail: why do you don’t want to install a public key on the server?

alex170872 10-24-2012 07:40 AM

Hi,

what I want to do is to TEST the server, and to execute scripts as part of the installed software. The best way to do this is to execute those scripts via ssh, because in that way you do not need to modify the system (For Testing, it is really important to test a setup as-is, without modifying it). I have several solutions:

- For each ssh execution, I can type the password. Very inconvenient for hundreds of instructions.
- I could add my public key on the server, but this violates the paradigm to leave the system in its to-test state, strictly spoken.

What I would like to have instead of
ssh <server> <command>
with typing the password something like
ssh -f <file_with_encrypted_password> <server> <command>
to perform the same task, just without typing the password all the time and without the need to change the system.

Hope this clarifies my special needs.


Thanks
Alex

Reuti 10-24-2012 07:51 AM

Quote:

Originally Posted by alex170872 (Post 4813765)
- I could add my public key on the server, but this violates the paradigm to leave the system in its to-test state, strictly spoken.

True, and I also argue that after the validation of the software on a machine you can neither upgrade the kernel nor exchange any libraries without redoing the validation. But for a public key on a user level I don’t see the impact.

Can you install anything on the server? Someone must have created the user account at least which you use for example.

Reuti 10-24-2012 09:35 AM

One additional note: you can also run 802.1x authentication on wire and the server you want to test would then need to contact an external RADIUS server for granting access - which is under your control again. I’m not sure whether it allows also an empty password – just an idea.

But again: something has to be done on the DUT.

suicidaleggroll 10-24-2012 09:42 AM

If this is just for testing, you could do it with an expect script. However this means your password is going to be shown in plain text in the script. Depending on the application, this might be acceptable though.

unSpawn 10-24-2012 10:12 AM

Quote:

Originally Posted by alex170872 (Post 4813765)
I could add my public key on the server, but this violates the paradigm to leave the system in its to-test state, strictly spoken.

Yes. And strictly spoken adding a (test) account, running any process, any network connection, any access, any logging on or into the testbed alters the state of the system. Unless modifying authorized_keys affects your tests significantly and in a way that can't be compensated for (you don't say what tests you actually want to run) you may be over-thinking and over-complicating things by not following standard procedure.

pingu 12-05-2012 09:01 AM

The thread is 6 weeks old by now, but since I did find another solution:
I also found sshpass and a few examples with "expect": http://stackoverflow.com/questions/4...to-ssh-command


All times are GMT -5. The time now is 08:16 PM.