ssh (as different user)

David Bandel david.bandel
Mon Jun 18 06:58:22 PDT 2007


On 6/18/07, Dirk Moolman <DirkM at agilitytech.co.za> wrote:
> Maybe one of you could help me.    I have set up ssh between 2 servers,
> so that I can ssh as the root user from the one server to the other
> server.  This works fine.
>
>
> My problem:
>
> I copied root's public rsa key, on the source, to oracle's
> authorized_keys file on the target, and now try to "ssh -l oracle", to
> the target server, but it prompts me for oracle's.   I also copied
> oracle's public rsa key, to oracle's authorized_keys file on the target
> server, but it still asks me for a password.
> The password I have to specify, is the oracle user's password on the
> target server.
>
> Any ideas why I cannot do this without a password ?

Client is system you will connect from, server is client you will connect to.
On client:
1.  As the user who will ssh into the server, create dsa public key
(ssh-keygen -t dsa).  Don't use a passphrase, save in your $HOME/.ssh
directory.
2.  scp .ssh/id_dsa.pub to server as user you want to enter (oracle)
into oracle's home directory and into the .ssh subdirectory as
authorized_keys ( scp .ssh/id_dsa.pub
oracle@$server:.ssh/authorized_keys)

On server:
1.  Ensure /etc/ssh/sshd_config contains:
RSAAuthentication yes
PubkeyAuthentication yes
and optionally:  AuthorizedKeysFile %h/.ssh/authorized_keys
2.  restart sshd if necessary

Go back to client and check to see if all works:
ssh -l oracle $server
you should just get a prompt back from the $server
Note:  if you run scripts using ssh, you'll want to make sure your
banner in the server is turned off:
#Banner /etc/issue.net



[laughable, unenforceable disclaimer, et. al., snipped]

Ciao,

David A. Bandel
-- 
Focus on the dream, not the competition.
            - Nemesis Air Racing Team motto



More information about the Linux-users mailing list