Solved

Ssh and sudo

Posted on 2012-04-11
6
824 Views
Last Modified: 2012-04-16
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
Comment
Question by:lcor
  • 3
  • 2
6 Comments
 
LVL 31

Assisted Solution

by:farzanj
farzanj earned 250 total points
ID: 37833359
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
 

Author Comment

by:lcor
ID: 37834081
farzanj, I'm experiencing technical difficulties at this time.  As soon as I can, I'll try the ssh with sudo.
0
 
LVL 31

Expert Comment

by:farzanj
ID: 37834088
No problem :)
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:lcor
ID: 37838312
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
 

Author Comment

by:lcor
ID: 37838463
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
 
LVL 27

Accepted Solution

by:
serialband earned 250 total points
ID: 37852189
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now