hawihoney Posted January 19, 2009 Share Posted January 19, 2009 I would like to copy some important files between two unRAID machines running the latest release. Because I thought about SSH first I installed these files from the current slackware distribution: installpkg openssl-0.9.8i-i486-2.tgz installpkg openssh-5.1p1-i486-1.tgz /etc/hosts.deny is empty but every attempt to connect the other machine ends in "ssh: connect to host Tower2 port 22: Connection refused". What did I forget? Many thanks in advance. Harald Quote Link to comment
hawihoney Posted January 19, 2009 Author Share Posted January 19, 2009 I decided to go the samba way (see below), however I would like to know what refuses SSH to work: cd /mnt/cache mkdir .Tower2 cd .Tower2 mkdir Dokumente mount -t cifs -o username=myuser,password=mypassword,umask=000 //Tower2/Dokumente /mnt/cache/.Tower2/Dokumente rsync -ai --delete --modify-window=1 /mnt/cache/.Tower2/Dokumente /mnt/user/Dokumente Harald Quote Link to comment
WeeboTech Posted January 19, 2009 Share Posted January 19, 2009 Here is my S20-init.rsyncd scriptlet to add rsync to the /etc/inetd.conf This allows you to use direct rsync without ssh and without a mount. #!/bin/bash if ! grep ^rsync /etc/inetd.conf > /dev/null ; then cat <<-EOF >> /etc/inetd.conf rsync stream tcp nowait root /usr/sbin/tcpd /usr/bin/rsync --daemon EOF read PID < /var/run/inetd.pid kill -1 ${PID} fi I put this in /boot/custom/etc/rc.d/S20-init.rsyncd I also have the following rsyncd.conf file in /etc It is copied from another script from /boot/custom/etc. You can add it to the above scriptlet. uid = root gid = root use chroot = no max connections = 4 pid file = /var/run/rsyncd.pid timeout = 600 [mnt] path = /mnt comment = /mnt files read only = FALSE [backups] path = /mnt/user/backups comment = Backups read only = FALSE [vmware] path = /mnt/user/backups/vmware comment = VMWare Backups read only = FALSE [music] path = /mnt/user/music comment = Music read only = FALSE pub] path = /mnt/disk1/pub comment = Public Files read only = FALSE [images] path = /mnt/disk1/images comment = Public Files read only = FALSE [boot] path = /boot comment = /boot files read only = FALSE [Videos] path = /mnt/user/Videos comment = VIDEOS read only = FALSE [bittorrent] path = /mnt/user/bittorrent comment = BITTORRENT read only = FALSE You probably only need the mnt one as it will allow access to the disk shares directly if you are copying disk to disk. Typical syntax when everything is in place (Slashes matter when doing directories. test it out before you script it or you may have duplicate directories) Take out the -n (dry run after you are satisfied). rsync -avP -n /mnt/disk1/images/ rsync://Tower/mnt/disk2/images Quote Link to comment
WeeboTech Posted January 19, 2009 Share Posted January 19, 2009 I would like to know what refuses SSH to work: Did you fire up the ssh daemon? Here is my /boot/custom/etc/rc.d/S20-install-sshd scriptlet Adjust PKGDIR according to your package directory. PKGDIR=/boot/custom/usr/share/packages PACKAGE=openssl-solibs-0.9.8g-i486-1 if [ ! -f /var/log/packages/$PACKAGE ] then installpkg ${PKGDIR}/$PACKAGE.tgz fi PACKAGE=openssh-4.6p1-i486-1 if [ ! -f /var/log/packages/$PACKAGE ] then installpkg ${PKGDIR}/$PACKAGE.tgz fi cp --preserve=timestamps /boot/custom/etc/ssh/ssh*key* /etc/ssh chmod 600 /etc/ssh/ssh*key* /etc/rc.d/rc.sshd start Note that after you start ssh for the first time. You need to save the host ssh key to /boot/custom/etc/ssh/ from /etc/ssh mkdir /boot/custom/etc/ssh cp --preserve=timestamps /etc/ssh /boot/custom/etc/ssh Quote Link to comment
hawihoney Posted January 19, 2009 Author Share Posted January 19, 2009 Weebotech, thank you very much. This helped and worked ... Thanks Harald Quote Link to comment
alphazo Posted December 3, 2009 Share Posted December 3, 2009 Hello, I'm trying to get SSH dameon started upon reboot while avoiding the key generation at each reboot. I followed the instructions above but when rebooted ssh is not installed (nor started) Here is the content of the relevant files on my USB flash drive: /boot/config/go #!/bin/bash # Start the Management Utility /usr/local/sbin/emhttp & /boot/unmenu/uu installpkg /boot/packages/pciutils-2.2.10-i486-2.tgz installpkg /boot/packages/unrar-3.7.8-i486-1stc_slack12.1.tgz installpkg /boot/packages/infozip-5.52-i486-2.tgz installpkg /boot/packages/ntfs-3g-2009.4.4-i486-1.tgz CTRLALTDEL=YES LOGSAVE=30 installpkg /boot/packages/powerdown-1.02-noarch-unRAID.tgz sysctl -w kernel.poweroff_cmd="/sbin/powerdown" # no longer used #installpkg /boot/packages/openssh-5.1p1-i486-1.tgz #/etc/rc.d/rc.sshd start /boot/custom/etc/rc.d/S20-install-sshd #!/bin/bash PKGDIR=/boot/packages PACKAGE=openssh-5.1p1-i486-1 if [ ! -f /var/log/packages/$PACKAGE ] then installpkg ${PKGDIR}/$PACKAGE.tgz fi cp --preserve=timestamps /boot/custom/etc/ssh/ssh*key* /etc/ssh chmod 600 /etc/ssh/ssh*key* /etc/rc.d/rc.sshd start Then I also have the following files on my USB flash drives: /boot/packages/openssh-5.1p1-i486-1.tgz /boot/custom/etc/ssh/ssh_host_key /boot/custom/etc/ssh/ssh_host_dsa_key /boot/custom/etc/ssh/moduli /boot/custom/etc/ssh/ssh_host_rsa_key /boot/custom/etc/ssh/sshd_config /boot/custom/etc/ssh/ssh_config /boot/custom/etc/ssh/ssh_host_dsa_key.pub /boot/custom/etc/ssh/ssh_host_key.pub /boot/custom/etc/ssh/ssh_host_rsa_key.pub Is there as specific switch to toggle in order to have scripts under /boot/custom executed during boot time? Thank you for your help. Alphazo Quote Link to comment
WeeboTech Posted December 3, 2009 Share Posted December 3, 2009 Is there as specific switch to toggle in order to have scripts under /boot/custom executed during boot time? Yes, if you have installed it into the go script. If not, then you can execute the /boot/custom/etc/rc.d/S20-install-sshd in the go script (where you have commented out the install package). Keep in mind that the first time the ssh package is installed a base config file is installed. The first time the ssh daemon is started via the rc.sshd script a key should be created. The files in /etc/ssh need to be copied to the /boot/custom/etc/ssh directory if any changes have been made. so after the first startup I would do a cp --preserve=timestamps /etc/ssh/ssh*key* /boot/custom/etc/ssh/ssh*key* you may want to copy the sshd_config file too. Quote Link to comment
alphazo Posted December 3, 2009 Share Posted December 3, 2009 Thank you. That did the trick. Reading through your post I though that /boot/custom/rc.d/ was kind of automatically read upon boot. Alphazo Quote Link to comment
Joe L. Posted December 3, 2009 Share Posted December 3, 2009 Is there as specific switch to toggle in order to have scripts under /boot/custom executed during boot time? You need to add a line to your "go" script to execute the scripts in /boot/custom. That is what is missing. It can be something like this: fromdos < /boot/custom/etc/rc.d/rc.local_startup | sh (It invokes a script named rc.local_startup which in turn invokes the scripts in /boot/custom/etc/rc.d) or if you only have a script or two to invoke you can just invoke them each in turn with lines like this: fromdos < /boot/custom/etc/rc.d/S20-install-sshd | sh Note: if you've use a unix compliant editor to create the scripts, and they do not have a "ms-dos" style carriage returns at the ends of lines, you can simplify and just put the path to the S* command in the "go" script as: /boot/custom/etc/rc.d/S20-install-sshd (The "fromdos" strips off the carriage returns you might have accidentally added) The entire method of starting and stopping add-on scripts will change in version 5 of unRAID. At that point we should have defined trigger points where we can install, start and stop added processes when the array is started and stopped. I'd keep it simple for now, as later it will change and your add-on scripts might need to change too. Joe L. Quote Link to comment
WeeboTech Posted December 3, 2009 Share Posted December 3, 2009 Thank you. That did the trick. Reading through your post I though that /boot/custom/rc.d/ was kind of automatically read upon boot. Alphazo It is if you install my /boot/custom/etc/rc.d/rc.local_startup and install the lines as Joe L mentioned. I hope later revs of unRAID have the hooks to call local startup scripts. Then we can have drop in directories for unRAID events. Until then, follow Joe's advice. Quote Link to comment
alphazo Posted December 3, 2009 Share Posted December 3, 2009 Thank you for the clarification. I just added a direct link to the script in 'go' and was able automatically start the daemon. One last thing, I noticed that everytime I login via SSH I get the following error in my syslog: error: Could not get shadow information for root Dec 3 14:29:52 babylon sshd[3266]: Accepted password for root from 10.201.0.132 port 60727 ssh2 Thank you Alphazo Quote Link to comment
WeeboTech Posted December 3, 2009 Share Posted December 3, 2009 I noticed that everytime I login via SSH I get the following error in my syslog: error: Could not get shadow information for root Dec 3 14:29:52 babylon sshd[3266]: Accepted password for root from 10.201.0.132 port 60727 ssh2 unRAID (emhttp) does not use nor add root to the /etc/shadow file. This has not caused me any problems so far. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.