• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 848
  • Last Modified:

Ssh and sudo

I have rsa keys setup between server A and server B.  server A needs to ssh into server B without a password.

Problem is that server B is setup to login as sudo without password.  So in order to get into server B, I have to log into a personal account, then do a "sudo su - accountname".  I am not given access to a password - it logs in automatically.

Realize this is probably the stupidest thing you ever heard but it is what it is.

I can't get ssh to log into server B without prompting for password even though I've correctly setup public, private keys (tested on a normal server with username and password authentication.)

Is this because of sudo for server B messes up things?  I read somewhere if you don't have password set for a server, ssh without password won't work.
0
lcor
Asked:
lcor
  • 3
  • 2
2 Solutions
 
farzanjCommented:
If ssh key mechism is setup, passwords are irrelevent.
Second if I understand you correctly , did you try:

ssh serverB "sudo su accountname -c ls"

Does this work for you?
0
 
lcorAuthor Commented:
farzanj, I'm experiencing technical difficulties at this time.  As soon as I can, I'll try the ssh with sudo.
0
 
farzanjCommented:
No problem :)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
lcorAuthor Commented:
farzanj, I tried your command and it still prompts for password.
I checked permissions on .ssh and authorized keys and they look good.
server A can successfully log into server C with the server A's public key in authorized_keys file
However server A is Solaris, server B is Linux, server C is Solaris
server A and server C run the same version of ssh
server A and server B run different versions of ssh
0
 
lcorAuthor Commented:
I also tried to setup keys between server A and server D.  They are both Linux and have sudo logins.  It doesn't work.  I seriously think it has something to do with sudo because the 2 Solaris servers have normal username and password logins but the Linux servers don't.
0
 
serialbandCommented:
You should be able to log in to root with ssh keys even without a password.  I log in all the time with ssh keys to accounts without passwords.  The settings to deny root login should be in your sshd.config.  You just need to set PermitRootLogin to yes in sshd.config

PermitRootLogin yes

Open in new window


I do this on ubuntu and osx systems, which both require sudo for root and block root password login by default.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now