SSH sudo password problem

Jonathan S. Romero jromero at raydiance-inc.com
Fri Oct 14 21:20:06 UTC 2005


Did you have to create the .ssh folder in /root manually?  Or did you
use this

sudo ssh-keygen -t dsa

? 

I would start with no .ssh subdirectory under root, then run that
command, then copy the generated id_dsa.pub in /root/.ssh/id_dsa.pub to
the server machine into authorized_keys.

Note the permissions on each directory have to be exact or you will have
problems.  Watch /var/log/debug and /var/log/auth.log
and /var/log/daemon.log 

I believe sshd tosses it's error messages to the auth log file.

-Jonathan

On Fri, 2005-10-14 at 16:34 -0400, Carthik Sharma wrote:
> 
> 
> On 10/14/05, Jonathan S. Romero <jromero at raydiance-inc.com> wrote:
>         Also if you run with cron, it will likely execute as root, and
>         will
>         again look in /root/.ssh for it's certificate when connecting.
> 
> Thank you,
> Copying /home/me/.ssh/id_rsa.pub to /root/.ssh/ does not solve the
> problem, though.
> 
> Can someone suggest a fix or a work around?
> 
> Also, if I put this in a cronjob, the "sudo " in the script will
> prompt me for my password at least once (Assuming I have the above
> problem fixed). How do I make it automated. In other words, how do I
> put a script that requires superuser previleges in cron ?
> 
> Thanks again,
> 
> Carthik.
> 
> 
>         On Fri, 2005-10-14 at 15:33 -0400, Carthik Sharma wrote:
>         > Hi Folks,
>         > 
>         > I have hit the wall (yet again) with my limited skills :o)
>         >
>         > I wrote a bash script to remotely backup files with ssh. I
>         have set up
>         > the ssh server, and the laptop to communicate without
>         passwords. 
>         >
>         > So....
>         > 1) If from the terminal, I try a
>         > $ssh -l carthik 1.sh.nu -p 8888
>         >
>         > I am logged in without being prompted for a password.
>         >
>         > 2) If I have the same in a shell script called
>         rsync_ssh_push.sh and 
>         > execute it thus:
>         > $ ./rsync_ssh_push.sh
>         >
>         > I am logged in without being prompted for a password
>         >
>         > However
>         > 3) If I execute the same script using
>         > $ sudo ./rsync_ssh_push.sh 
>         >
>         > I am repeatedly asked for my (carthik's) password, for each
>         instance
>         > of an ssh statement in the script! In the script I try to
>         log in to
>         > the remote server as user carthik, not as user "root" or
>         anything of 
>         > that sort.
>         >
>         > Any hints as to why $sudo ./rsync_ssh_push.sh behaves
>         differently from
>         > $ ./rsync_ssh_push.sh ?
>         >
>         > Thanks,
>         > Carthik.
>         >
>         > P.S. I can share the script once I am done fixing this
>         problem :) 
>         >





More information about the ubuntu-users mailing list