I want to run a script on another machine. Is there anyway to do it without any kind of authentication even if I'm running it for the first time on that machine? It is assumed that the other machine is trusted. I can't use ssh as it breaks the continuous process and prompts for user password and I want that process to be continuous. Please suggest if there is any way to achieve this. I've tried everything I could using ssh but to no avail.
-
Why can you not put your public key on the remote machine so that you can login without a password using ssh? – Noufal Ibrahim Jul 19 '11 at 11:15
-
I can't do that because some of the remote machines do not have a .ssh/ folder. So I'm not sure where to add my public key on such remote machines. – latestVersion Jul 19 '11 at 11:40
-
You'll have to have some account on them atleast to decide the privileges of what you're running. – Noufal Ibrahim Jul 19 '11 at 12:53
-
Some of those remote machines are production servers and only the admin will have an account on it. So I just have to do with the fact that there is no **.ssh/** folder in that machine. And creating that folder is also out of question as I won't have required privileges. – latestVersion Jul 20 '11 at 10:40
-
As what user do you plan to run your scripts on the remote machine if the only account there is `root`? – Noufal Ibrahim Jul 20 '11 at 10:42
-
My bad. I meant to say "only the admin will have an account on it with write privileges". I can run my script on the machine but I won't be able to create anything new in there. – latestVersion Jul 20 '11 at 10:57
-
As what user are you running your script? – Noufal Ibrahim Jul 20 '11 at 11:41
-
I'll be running it with my user id and I can run the script in any machine. But I can't create the .ssh/ folder in any machine I want. – latestVersion Jul 21 '11 at 06:27
-
If you're running it as a user `quux` on a remote host, that user will have a home directory (probably `/home/quux`) which you can write to. You can create a `.ssh` directory there and put the `authorized_keys` file there so that you can ssh in there without manually requiring authentication. – Noufal Ibrahim Jul 21 '11 at 06:30
-
On most machines I can do what you're suggesting. But on some machines whenever I login with say user `quux` I get a error saying `cannot change to dir /home/quux` and then it gives me `/` as the prompt. – latestVersion Jul 21 '11 at 09:05
2 Answers
Since you say you don't know where the authorized keys file resides, check this setting in your sshd_config
:
AuthorizedKeysFile
Specifies the file that contains the public keys that can be used for user authentication. AuthorizedKeysFile may contain tokens of the form %T which are substituted during connection set-up. The following tokens are defined: %% is replaced by a literal '%', %h is replaced by the home directory of the user being authenticated and %u is replaced by the username of that user. After expansion, AuthorizedKeysFile is taken to be an absolute path or one relative to the user's home directory. The default is ``.ssh/authorized_keys.
If it is not set, just create a .ssh
dir in your home directory and add the key of the client. Unless you have any unusual settings in the sshd_config
, you should now login without entering a password (unless you've password protected your key file, which is normally recommended)

- 12,203
- 5
- 48
- 82
-
Thank you for the answer but I'm afraid it won't help. Not because it doesn't work (I don't know if it will) but because I don't have enough privileges to even read that file. And I also won't be able to create the **.ssh** folder as I'll have to run the script on some of the production servers and again permission issues crawl up. – latestVersion Jul 20 '11 at 10:38
-
In my humble opinion, anyone who denies you the ability to use ssh keys to login, but would let you execute arbitrary scripts with a password-less login is not quite sane. Request the server operator create the neccesary files/folders. Using ssh keyed login is _the_ way to do this. – carlpett Jul 20 '11 at 11:36
In case you have trusted network you could try rlogin.

- 11,779
- 12
- 64
- 94
-
1I can't use rlogin as it'll still throw a prompt for password and I do not want this as the process has to be continuous. – latestVersion Jul 19 '11 at 11:43