How to automatically enter password in a script?

Hi
I'm working with AIX 6.1
I would like to ssh to a server without entering password ( to monitor something) but there's no way to do that by authentication keys, so I need to write a script which can ssh to that server without entering password ( no need to hide passsword in the script, just an user account to monitor ).

Can someone help me please :(:(:frowning:

Use ssh-keygen . Google or seach within the forum for more details.

1 Like

As I said above, the authentication keys doesn't work in this case ( actually it's because of the limit of the OS and some security reasons )

For security reasons, it would make sense to enable ssh and not enforcing plaintext passwords in scripts, as THAT is a higher risk, due to the passwords beeing readable by everyone!
Specialy, since you want to ssh on your server...

Just my 2 cents.

1 Like

Ah, I missed that point. You mentioned there is no option to use those! What issues you facing?

Apart from ssh-keygen, you can use expect .

1 Like

Because of the limit of the OS version of the server ( which can not update to a higher version ) I want to ssh, I can not ssh without password to that server by an user account ( it requires admin account ). If I could done it, I would have done it already.

So please stop talking about the ssh-keygen. :mad::mad::mad:

---------- Post updated at 04:51 AM ---------- Previous update was at 04:46 AM ----------

Could you show me detail code, because I found some examples using expect , but it seems not work :confused::confused::confused:. Thank you

Assuming that you are not using ssh at all, can I presume that rlogin would be allowed? You can grant (for a given user) the source addresses that can rlogin to it without further credentials being required.

Does that offer an option? I would try to avoid expect if possible because of the risks and complexities that it introduces.

Robin

1 Like

I would like to write a script to connect from an AIX server to a SAN switch running FabOS 6.4 ( which can't upgrade to version 7 ) to monitor somethings. FabOS version 7 has a feature allowing an admin account to import authentication key for any users, but FabOS 6 doesn't. In FabOS 6, an admin account can import authentication key for only itself. It means that if I connect to that SAN switch using ssh-keygen, I'll have to login directly to an admin account, and this isn't my choice. I just want to do this by an user account.

Not using ssh-keygen means that each time I run the script, I have to enter the password. It's the problem I'm facing :(:(:(.

As i see in documentation, you can create a user with admin role for which you can use ssh keys.

"The default admin user must set up the allowed-user with the admin role."

I haven't done this myself, but i suspect that admin role for user will be able to fulfill your request regarding "monitoring somethings"

Hope the helps.

Regards
Peasant.

1 Like

As what I read. there's no option to do that in FabOS, admin is admin.