Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

GNUPG and SFTP =(

  • 05-09-2007 9:17pm
    #1
    Registered Users, Registered Users 2 Posts: 8,584 ✭✭✭


    Hey guys,

    Maybe you can help with this problem...

    I've generated a public/private key pair and exported both. I'm trying to use SFTP to transfer files off my server to a remote server which is used to store backups. Since this will be fully automated, the "Password:" prompt when it hits the sftp <user>@&lt;host> part of the script is driving me nuts.

    You know where I'm meant to put the public key on the remote server? Or do I need to put a key from the remote server onto the local one ..or what am I doing wrong..

    Everything I've read centres on RSA encryption using SSH-Gen or something, but I'm using GNUPG which is using DSA encryption.

    Driving me nuts - each time I test and see Password: I die a little inside...


Comments

  • Closed Accounts Posts: 1,467 ✭✭✭bushy...


    From http://ludwikc.net , script to do it for you

    #!/bin/sh
    cd $HOME
    echo "Passwordless ssh (v. 0.6)"
    echo "Enter your ssh username:"
    read user
    echo "Host (or ip):"
    read host
    # Ports added in 0.4
    echo "Enter ssh port: (press Enter if you don't know)"
    read port
    if port=NULL
    then port=22
    fi
    echo "Wait for connection and type password for given username"
    scp -P $port $HOME/.ssh/id_rsa.pub $user@$host:~/id_rsa-passwordless.pub
    echo "Success: RSA key exported."
    echo "Last with-password ssh login..."
    ssh $user@$host -p $port "if [ -d $HOME/.ssh ]
    then
    echo "Success: Directory $HOME/.ssh/ exists."
    else
    echo -e "There is no $HOME/.ssh/ directory." && mkdir $HOME/.ssh && echo "Success: Directory $HOME/.ssh has been created"
    fi &&
    cat ~/id_rsa-passwordless.pub >> .ssh/authorized_keys && rm id_rsa-passwordless.pub && chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys && exit"
    echo "Authorization successful!"
    # Added in 0.3 version - symlinks providing easier login
    echo ""
    if [ -d $HOME/.ssh/passwordless_login ]
    then
    echo "Directory $HOME/.ssh/passwordless_login has been created during last passwordless_ssh usage."
    else
    mkdir $HOME/.ssh/passwordless_login
    fi
    echo ssh $user@$host -p $port >> ~/.ssh/passwordless_login/$host
    chmod +x ~/.ssh/passwordless_login/$host
    ln -s ~/.ssh/passwordless_login/$host $host
    echo "From now-on simply type ./$host, to log-in without password."
    echo "Passwordless ssh by Ludwik C. Siadlak (http://ludwikc.net). GPL Licence. Have a nice day!"


  • Registered Users, Registered Users 2 Posts: 8,584 ✭✭✭TouchingVirus


    Thanks for that bushy.

    I've just figured it out before reading your post but your's does what I wanted too :D

    My flawed logic believe PGP keys could be used to authenticate SSH sessions - maybe they can. I just generated a pair of SSH DSA Keys and added the public one to .ssh/authorized_keys and voila - works like a charm :D

    What can I say, small achievements like this make me feel less like a n00b each day :D


Advertisement