Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
sshd
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Mr Tom
n00b
n00b


Joined: 22 Nov 2009
Posts: 1

PostPosted: Sun Nov 22, 2009 8:23 pm    Post subject: sshd Reply with quote

Hi Guys

Im new here and have a quick question

I wish for sshd to begin at startup im not sure how to do this I would like o generate rsa keys when i set sshd off on manual.
Hope someone can help as my head hurts tring to figure it out

Regards
Mr Tom
Back to top
View user's profile Send private message
coRpTitan
n00b
n00b


Joined: 21 Aug 2005
Posts: 55
Location: Czech Republic, Brno

PostPosted: Sun Nov 22, 2009 8:32 pm    Post subject: Reply with quote

Hello Mr Tom,

As root run rc-update add sshd default
This will add sshd service into default run level.
Regarding sshd certs: I'm not sure if I understand question properly, but this init script should generate new certificates if it can't find old one in default location(in case you newly installed sshd).

This is code of init script (/etc/init.d/sshd) which generates certs. :

Code:
gen_keys() {
        if [ ! -e "${SSHD_CONFDIR}"/ssh_host_key ] ; then
            einfo "Generating Hostkey..."
            /usr/bin/ssh-keygen -t rsa1 -b 1024 -f "${SSHD_CONFDIR}"/ssh_host_key -N '' || return 1
        fi
        if [ ! -e "${SSHD_CONFDIR}"/ssh_host_dsa_key ] ; then
            einfo "Generating DSA-Hostkey..."
            /usr/bin/ssh-keygen -d -f "${SSHD_CONFDIR}"/ssh_host_dsa_key -N '' || return 1
        fi
        if [ ! -e "${SSHD_CONFDIR}"/ssh_host_rsa_key ] ; then
            einfo "Generating RSA-Hostkey..."
            /usr/bin/ssh-keygen -t rsa -f "${SSHD_CONFDIR}"/ssh_host_rsa_key -N '' || return 1
        fi
        return 0
}
Back to top
View user's profile Send private message
xtz
Apprentice
Apprentice


Joined: 29 Oct 2007
Posts: 181
Location: Singapore

PostPosted: Mon Nov 23, 2009 4:08 pm    Post subject: Re: sshd Reply with quote

Mr Tom wrote:
...
I wish for sshd to begin at startup im not sure how to do this I would like o generate rsa keys when i set sshd off on manual.
...
From what I get - you want sshd to remove the existing certificates, when you turn it off? You can modify the function, thats stops sshd in the init script to remove the existing certificates, but this will happen everytime you turn off sshd (even during reboot, or restarting as a dependent service), which is probably not what you want to do, as you said "set sshd off ot manual". Or you can write another script for you, based on that function, so when you want to manually stop sshd and remove the certificates - you can use it.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum