Results 1 to 3 of 3

Thread: howto: Enabling sshd on Corza

  1. #1
    Join Date
    Jul 2009
    Location
    France
    Posts
    7

    Default howto: Enabling sshd on Corza

    Thanks to cjcliffe for his howto about enabling telnet and expanding corza's linux functionality.


    Using these wonderful informations, I tried to start the sshd daemon we can find in the corza_linux_ext.tgz package supplied by cjcliffe

    The challenge was to start the sshd daemon at the boot of the Corza NAS.
    My aim is to use my Corza that is powered on 24/24 like a ssh server for getting my datas or access to my home computers from an internet secured access.
    It works fine now and it is possible also using ssh tunneling. It works also with scp.












    These are the steps of installation :

    1. Install telnet : http://www.patriotmemory.com/forums/...ead.php?t=1977

    2. install corza_linux_ext.tgz package like in the thread, that is to say /mnt/md1/linux
    http://www.patriotmemory.com/forums/...ead.php?t=2137


    3. create a directory for storing ssh parameters : mkdir -p /mnt/md1/linux/ssh



    4. Create keys for sshd (without passphrase for me)
    cd /mnt/md1/linux
    ./usr/bin/ssh-keygen -t rsa -f /mnt/md1/linux/ssh/ssh_host_rsa_key
    ./usr/bin/ssh-keygen -t dsa -f /mnt/md1/linux/ssh/ssh_host_dsa_key



    5. copy this file content in /mnt/md1/linux/ssh/sshd_config. You can modify like you want.

    The default parameters I modified are :
    HostKey /mnt/md1/linux/ssh/ssh_host_rsa_key
    HostKey /mnt/md1/linux/ssh/ssh_host_dsa_key
    UsePrivilegeSeparation no
    PasswordAuthentication yes

    # Package generated configuration file
    # See the sshd(8) manpage for details

    # What ports, IPs and protocols we listen for
    Port 22
    # Use these options to restrict which interfaces/protocols sshd will bind to
    #ListenAddress ::
    #ListenAddress 0.0.0.0
    Protocol 2
    # HostKeys for protocol version 2
    HostKey /mnt/md1/linux/ssh/ssh_host_rsa_key
    HostKey /mnt/md1/linux/ssh/ssh_host_dsa_key
    #Privilege Separation is turned on for security
    UsePrivilegeSeparation no

    # Lifetime and size of ephemeral version 1 server key
    KeyRegenerationInterval 3600
    ServerKeyBits 768

    # Logging
    SyslogFacility AUTH
    LogLevel INFO

    # Authentication:
    LoginGraceTime 120
    PermitRootLogin yes
    StrictModes yes

    RSAAuthentication yes
    PubkeyAuthentication yes
    #AuthorizedKeysFile %h/.ssh/authorized_keys

    # Don't read the user's ~/.rhosts and ~/.shosts files
    IgnoreRhosts yes
    # For this to work you will also need host keys in /etc/ssh_known_hosts
    RhostsRSAAuthentication no
    # similar for protocol version 2
    HostbasedAuthentication no
    # Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
    #IgnoreUserKnownHosts yes

    # To enable empty passwords, change to yes (NOT RECOMMENDED)
    PermitEmptyPasswords no

    # Change to yes to enable challenge-response passwords (beware issues with
    # some PAM modules and threads)
    ChallengeResponseAuthentication no

    # Change to no to disable tunnelled clear text passwords
    PasswordAuthentication yes

    # Kerberos options
    #KerberosAuthentication no
    #KerberosGetAFSToken no
    #KerberosOrLocalPasswd yes
    #KerberosTicketCleanup yes

    # GSSAPI options
    #GSSAPIAuthentication no
    #GSSAPICleanupCredentials yes

    X11Forwarding yes
    X11DisplayOffset 10
    PrintMotd no
    PrintLastLog yes
    TCPKeepAlive yes
    #UseLogin no

    #MaxStartups 10:30:60
    #Banner /etc/issue.net

    # Allow client to pass locale environment variables
    AcceptEnv LANG LC_*

    Subsystem sftp /usr/lib/openssh/sftp-server

    UsePAM no



    6. Create the directory : mkdir -p /system/local/etc/rc.d




    7. in /system/local/etc/rc.d, create the S95sshd.sh file (only the .sh extension is necessary, the name may be anything). Put the execution right for u,g,o



    8. in the S95sshd.sh, copy these lines :

    #!/bin/sh
    #
    # S95sshd.sh - startup script for sshd
    #
    #

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/mnt/md1/linux/lib:/mnt/md1/linux/usr/lib

    # this file is used by sshd, not mandatory but a warning is logged without it
    touch /var/log/lastlog

    /mnt/md1/linux/usr/sbin/sshd -f /mnt/md1/linux/ssh/sshd_config &

    # without these lines, a problem occurs when using a remote scp client
    echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/mnt/md1/linux/lib:/mnt/md1/linux/usr/lib" >> /etc/profile
    echo "export PATH=$PATH:/mnt/md1/linux/usr/bin" >> /etc/profile
    !!!! without the & at the end of the sshd start command , the boot of Corza freezes
    !!!! executing the couple of echo allows the remote scp client to execute local scp


    9. Try a test by executing ./S95sshd.sh and connecting by putty or other.



    10. If it works, reboot the system and see
    ! after reboot, sshd take few minutes (2 or 3 ?) before be on.



    I make a lot of mistakes before succeeding, and I am not responsible for your manipulations, each take his responsabilities

    Tips :
    I discovered these stuffs that can help someone in the case you are wrong.

    The system has a little partition on the disks (/system) where it cans save the differents parameters.
    If you make a mistake when you develop and the Corza doesn't start (blue light blinding all the time), I fixed it by connecting one of the disk inside a linux computer and delete the file S95sshd.sh on the /system/local/rc.d partition.
    (I work with raid 1 but with only one disk, I backup up the second disk in order to keep my datas)
    I found this by watching in /etc/rc.

    I think we must redo this installation after each new version of the firmware
    Last edited by baribal78; 12-22-2009 at 10:02 AM.

  2. #2
    Join Date
    Nov 2009
    Posts
    4

    Default

    very thanx. This is good support.

  3. #3
    Join Date
    Jul 2010
    Posts
    3

    Default

    Update: NM, I saw that you didn't enter a passphrase while key generation, and tried removing mine and it worked like a charm.

    Thanks for writing this up for us. I think you missed to mention "chmod +x" for the S95sshd.sh file. I am facing a different issue. When I try to do a test start, I get this error:

    Code:
    bash-3.00# /system/local/etc/rc.d/S95sshd.sh
    bash-3.00# Could not load host key: /mnt/md1/linux/ssh/ssh_host_rsa_key
    Could not load host key: /mnt/md1/linux/ssh/ssh_host_dsa_key
    Disabling protocol version 2. Could not load host key
    sshd: no hostkeys available -- exiting.
    I checked that the paths are correct:

    Code:
    bash-3.00# ls -l /mnt/md1/linux/ssh/ssh_host_dsa_key
    -rw-------    1 root     root          736 Jul  1 09:39 /mnt/md1/linux/ssh/ssh_host_dsa_key
    bash-3.00# ls -l /mnt/md1/linux/ssh/ssh_host_rsa_key
    -rw-------    1 root     root          951 Jul  1 09:38 /mnt/md1/linux/ssh/ssh_host_rsa_key
    What could be the problem here?
    Last edited by irha; 07-01-2010 at 04:57 PM. Reason: Found the fix.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •