1

I usually connect to my AIX server using putty via my regular account and then do "su - otherAccount". This way I've to enter password twice, one for my account and one for the otherAccount. I've noticed if I add the "su - otherAccount" in my .profile, I just have to enter the password of the otherAccount as soon as I'm logged in and no need to enter the step "su - otherAccount". Is there anyway, I can even store the password of the "otherAccount" in my .profile or somewhere else, that I just have to enter my password and it will switch me to the otherAccount whenever I go in putty.

1 Answer 1

2

Two ideas:

(a) Why don't you login as otherAccount in the first place? (I guess there is a reason, but I just have to mention it).

(b) Don't use passwords for login, but an SSH key. Use Putty to generate a key, and you should, nay, must really protect it with a passphrase. Run Putty Agent on your PC to supply this key to further ssh logins so you need to enter the ssh key passphrase only once (with Putty Agent, when it loads the key). Put the public key on the AIX machine into ~/.ssh/authorized_keys for your regular account and for otherAccount. Log in to the machine using the key; then use "ssh otherAccount@localhost" to log into otherAccount without entering the password.

Putting the password into .profile is a very bad idea, and it is the reason why su, sudo, ssh, and the like don't support reading the password from a file.

If you are not accustomed to using public ssh keys with Putty and Putty Agent, you will have to read some documentation. Do it, it is worth it. Be aware that you'll have to export the public key from Putty in OpenSSH format -- Putty's native key format does not work with ~/.ssh/authorized_keys.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .