how do i avoid this rsync issue


comet424

Recommended Posts

ok. now that ssh is working. you'll observe that the next time around, it won't ask about the fingerprint anymore.

The authenticity of host '192.168.71.1 (192.168.71.1)' can't be established.
RSA key fingerprint is SHA256:DsrQk63wK2wX+GZRvT8Z2eP3C/W3qk9jb4z5cQQ4nyg.
Are you sure you want to continue connecting (yes/no)?

it's time we generated the ssh keys, so it won't ask you about the password (ie you can use a script to do the rsync after)

On 3/1/2019 at 9:30 AM, ken-ji said:

On tower:


# ssh-keygen -t rsa -b 2048 -f /boot/config/ssh/tower_root
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase): [press enter here]
Enter same passphrase again: [press enter here]
# scp /boot/config/ssh/tower_root.pub mitchsserver:/boot/config/ssh

The SCP should prompt for the root password. Make sure you set one in the GUI.

 

Repeat for mitchsserver:


# ssh-keygen -t rsa -b 2048 -f /boot/config/ssh/mitchsserver_root
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase): [press enter here]
Enter same passphrase again: [press enter here]
# scp /boot/config/ssh/mitchsserver_root.pub tower:/boot/config/ssh

Again here.

 

Then add this to tower go file


mkdir -p /root/.ssh
cp /boot/config/ssh/tower_key /root/.ssh/id_rsa
cat /boot/config/ssh/mitchsserver_key.pub > /root/.ssh/authorized_keys
chmod g-rwx,o-rwx -R /root/.ssh

and the mitchsserver go file


mkdir -p /root/.ssh
cp /boot/config/ssh/tower_key /root/.ssh/id_rsa
cat /boot/config/ssh/mitchsserver_key.pub > /root/.ssh/authorized_keys
chmod g-rwx,o-rwx -R /root/.ssh

Then on each server, run the same lines you inserted into the go file

 

then test it by running on tower


root@tower:~# ssh mitchsserver echo Hello
Hello
root@tower:~# 

root@mitchsserver:~# ssh tower echo Hello
Hello
root@mitchsserver:~# 

So can you do these steps first?

Link to comment

@ken-ji ill try this in the morning I falling a sleep

 

but question  is I noticed I was doing      /.ssh   and you do  /ssh  is there a difference???    as I noticed also cat config file you had me do also talks about .ssh as a default  and the one instructions  talks about .ssh  

are they 2 different     .ssh   ssh  or are they the same

I appreciate so far  as that was frustrating  I will do the steps In the morning

 

Link to comment

Please take a closer look.

/root/.ssh is a default place where the ssh tools (ssh / scp) look for user (root) config files and keys

/boot/config/ssh is an unraid location on the flash drive (\\tower\flash\config\ssh) where the system ssh service config files and keys are stored

so what we are doing is generating the keys in flash (/boot/config/ssh) and copying them to the ram (/root/.ssh) during bootup.

 

Ok. go to sleep and don't try to rush this. After this part you will be able to do the rsync without prompts.

Link to comment

@ken-ji  so it kinda worked but no

tower is unable to scp over    but mitchsserver could scp

I then tryied the go files like you mentioned and neither can find files    so I copied the 2 files in windows shares over to the flash drive

Linux 4.18.20-unRAID.
Last login: Sat Mar  2 10:36:58 -0500 2019 on /dev/pts/0.
root@mitchsserver:~# ssh-keygen -t rsa -b 2048 -f /boot/config/ssh/mitchsserver_root
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /boot/config/ssh/mitchsserver_root.
Your public key has been saved in /boot/config/ssh/mitchsserver_root.pub.
The key fingerprint is:
SHA256:Vy1EAWLaiqaPVEM+/d0tetyFAMZ5Vdg8ZN5yg4QZJ+E root@mitchsserver
The key's randomart image is:
+---[RSA 2048]----+
|        o..BO=oB.|
|       + .*+=.=.+|
|    . . .. Eo.oo+|
|   o o .   ... o.|
|    B o S .  . . |
|   + o . o . .. .|
|  o     . ..o... |
| . o       .o..  |
|  . .     ..     |
+----[SHA256]-----+
root@mitchsserver:~# scp /boot/config/ssh/mitchsserver_root.pub tower:/boot/config/ssh
root@tower's password:
mitchsserver_root.pub                                                                      100%  399     1.3MB/s   00:00
root@mitchsserver:~# mkdir -p /root/.ssh
root@mitchsserver:~# cp /boot/config/ssh/tower_key /root/.ssh/id_rsa
cp: cannot stat '/boot/config/ssh/tower_key': No such file or directory
root@mitchsserver:~# cat /boot/config/ssh/mitchsserver_key.pub > /root/.ssh/authorized_keys
cat: /boot/config/ssh/mitchsserver_key.pub: No such file or directory
root@mitchsserver:~# chmod g-rwx,o-rwx -R /root/.ssh
root@mitchsserver:~# mkdir -p /root/.ssh
root@mitchsserver:~# cp /boot/config/ssh/tower_key /root/.ssh/id_rsa
cp: cannot stat '/boot/config/ssh/tower_key': No such file or directory
root@mitchsserver:~# cat /boot/config/ssh/mitchsserver_key.pub > /root/.ssh/authorized_keys
cat: /boot/config/ssh/mitchsserver_key.pub: No such file or directory
root@mitchsserver:~#
Linux 4.18.20-unRAID.
Last login: Sat Mar  2 13:43:00 -0500 2019 on pts/1 from 192.168.0.244.
root@Tower:~# ssh-keygen -t rsa -b 2048 -f /boot/config/ssh/tower_root
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /boot/config/ssh/tower_root.
Your public key has been saved in /boot/config/ssh/tower_root.pub.
The key fingerprint is:
SHA256:zcwHD/+mB3oHQr6YYy2T2kax4hXXGCkdliHv2SDjpK4 root@Tower
The key's randomart image is:
+---[RSA 2048]----+
|        ..+=     |
|        .+=      |
|        +.=+     |
|       +oO+O.    |
|      . SBB =    |
|     .. + o.o.   |
|     ..+ = + oo  |
|     ...X + .oo  |
|    E .+.+ ..o   |
+----[SHA256]-----+
root@Tower:~# scp /boot/config/ssh/tower_root.pub mitchsserver:/boot/config/ssh
root@mitchsserver's password:
/boot/config/ssh/tower_root.pub: No such file or directory
root@Tower:~# scp /boot/config/ssh/tower_root.pub root@mitchsserver:/boot/config/ssh
root@mitchsserver's password:
/boot/config/ssh/tower_root.pub: No such file or directory
root@Tower:~# scp /boot/config/ssh/tower_root.pub root@mitchsserver:/boot/config/ssh/
root@mitchsserver's password:
/boot/config/ssh/tower_root.pub: No such file or directory
root@Tower:~# cd boot
-bash: cd: boot: No such file or directory
root@Tower:~# cd /boot
root@Tower:/boot# cd config
root@Tower:/boot/config# cd ssh
root@Tower:/boot/config/ssh# ls
ssh_host_dsa_key*      ssh_host_ecdsa_key*      ssh_host_ed25519_key*      ssh_host_rsa_key*      tower_root*
ssh_host_dsa_key.pub*  ssh_host_ecdsa_key.pub*  ssh_host_ed25519_key.pub*  ssh_host_rsa_key.pub*  tower_root.pub*
root@Tower:/boot/config/ssh# scp /boot/config/ssh/tower_root.pub mitchsserver:/boot/config/ssh/
root@mitchsserver's password:
/boot/config/ssh/tower_root.pub: No such file or directory
root@Tower:/boot/config/ssh# scp /boot/config/ssh/tower_root.pub mitchsserver:/boot/config/ssh
root@mitchsserver's password:
/boot/config/ssh/tower_root.pub: No such file or directory
root@Tower:/boot/config/ssh# mkdir -p /root/.ssh
root@Tower:/boot/config/ssh# cp /boot/config/ssh/tower_key /root/.ssh/id_rsa
cp: cannot stat '/boot/config/ssh/tower_key': No such file or directory
root@Tower:/boot/config/ssh# cat /boot/config/ssh/mitchsserver_key.pub > /root/.ssh/authorized_keys
cat: /boot/config/ssh/mitchsserver_key.pub: No such file or directory
root@Tower:/boot/config/ssh# chmod g-rwx,o-rwx -R /root/.ssh
root@Tower:/boot/config/ssh#

 

Link to comment

rm -fvr /boot/config/ssh

rm -fbr /root/.ssh  

and rebooted and re tried your steps  still cant copy the id_rsa   if I move to the folder  boot/config/ssh  and do a copy tower_key /root/.ssh/   then that works  but not the other way   and  scp command only worked  while I was ssh tower  or ssh mitchsserver

not in there own terminal windows

so I closer but still cant get to work right lol

 

Link to comment
Linux 4.18.20-unRAID.
Last login: Sat Mar  2 11:35:19 -0500 2019 on /dev/pts/0.
root@mitchsserver:~# ssh root@tower
root@tower's password:
Last login: Sat Mar  2 14:43:30 2019
Linux 4.18.20-unRAID.
root@Tower:~# ssh-keygen -t rsa -b 2048 -f /boot/config/ssh/tower_root
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /boot/config/ssh/tower_root.
Your public key has been saved in /boot/config/ssh/tower_root.pub.
The key fingerprint is:
SHA256:iEViwD+4eZYGssUtNdE0YgfA1UnhHN1Fnb6S+c83RjQ root@Tower
The key's randomart image is:
+---[RSA 2048]----+
| oo+OBO+ . oo. . |
|  oooB+o. .   o  |
| . = .+      .   |
|. * +o .      .E |
| + =.o. S    o...|
|. o =       + .. |
|   +         o.  |
|              .+.|
|              ..=|
+----[SHA256]-----+
root@Tower:~# scp /boot/config/ssh/tower_root.pub mitchsserver:/boot/config/ssh
root@mitchsserver's password:
tower_root.pub                                                                             100%  392   772.4KB/s   00:00
root@Tower:~# mkdir -p /root/.ssh
root@Tower:~# cp /boot/config/ssh/tower_key /root/.ssh/id_rsa
cp: cannot stat '/boot/config/ssh/tower_key': No such file or directory
root@Tower:~# cd /root/.ssh
root@Tower:~/.ssh# ;s
-bash: syntax error near unexpected token `;'
root@Tower:~/.ssh# ls
authorized_keys  known_hosts
root@Tower:~/.ssh# cd /boot/config/ssh
root@Tower:/boot/config/ssh# ;s
-bash: syntax error near unexpected token `;'
root@Tower:/boot/config/ssh# ls
mitchsserver_root.pub*  ssh_host_ecdsa_key*      ssh_host_ed25519_key.pub*  tower_root*
ssh_host_dsa_key*       ssh_host_ecdsa_key.pub*  ssh_host_rsa_key*          tower_root.pub*
ssh_host_dsa_key.pub*   ssh_host_ed25519_key*    ssh_host_rsa_key.pub*
root@Tower:/boot/config/ssh# cp tower_root /root/.ssh/id_rsa
root@Tower:/boot/config/ssh# cd /root
root@Tower:~# ls .ssh
authorized_keys  id_rsa*  known_hosts
root@Tower:~# cd ..
root@Tower:/# rm -frv /root/.ssh
removed '/root/.ssh/id_rsa'
removed '/root/.ssh/known_hosts'
removed '/root/.ssh/authorized_keys'
removed directory '/root/.ssh'
root@Tower:/# mkdir -p /root/.ssh
root@Tower:/# cp /boot/config/ssh/tower_key /root/.ssh/id_rsa/
cp: cannot stat '/boot/config/ssh/tower_key': No such file or directory
root@Tower:/# cp /boot/config/ssh/tower_key /root/.ssh/id_rsa
cp: cannot stat '/boot/config/ssh/tower_key': No such file or directory
root@Tower:/#

 

Link to comment

@ken-ji now from your cp  for go file I think you ment tower_root  not tower_key    and I dunno seems to be bot the same mitchsserver and tower  and I not sure what a id_rsa

 

but here if I don't do the ssh mitchsserver and then do copying it doesn't work.. works from  mitchsserver to tower but not vise versa... im thinking tower is broken  because of the broken pipe  before the tower login  from the console side

 

Linux 4.18.20-unRAID.
root@Tower:~# ssh-keygen -t rsa -b 2048 -f /boot/config/ssh/tower_root
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /boot/config/ssh/tower_root.
Your public key has been saved in /boot/config/ssh/tower_root.pub.
The key fingerprint is:
SHA256:yj4TqajM88malFjBnL1XrStVupgsndhtB7eAJwBwbkY root@Tower
The key's randomart image is:
+---[RSA 2048]----+
|..E              |
| * +     .       |
|  O o   . o      |
| o . o o +       |
|  . . +.S .      |
|...  BoX * .     |
|.o .o.@.= o      |
|+.+ oooo .       |
|.*++  .o         |
+----[SHA256]-----+
root@Tower:~# scp /boot/config/ssh/tower_root.pub mitchsserver:/boot/config/ssh
The authenticity of host 'mitchsserver (192.168.0.244)' can't be established.
ECDSA key fingerprint is SHA256:APbRWv8D+cAMRGW1g4XnvufCGR/6hSe/lsk07JMVdSQ.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'mitchsserver,192.168.0.244' (ECDSA) to the list of known hosts.
root@mitchsserver's password:
/boot/config/ssh/tower_root.pub: No such file or directory
root@Tower:~# scp /boot/config/ssh/tower_root.pub mitchsserver:/boot/config/ssh/
root@mitchsserver's password:
/boot/config/ssh/tower_root.pub: No such file or directory
root@Tower:~# ssh mitchsserver
root@mitchsserver's password:
Last login: Sat Mar  2 12:13:58 2019
Linux 4.18.20-unRAID.
root@mitchsserver:~# exit
logout
Connection to mitchsserver closed.
root@Tower:~# scp /boot/config/ssh/tower_root.pub mitchsserver:/boot/config/ssh/
root@mitchsserver's password:
/boot/config/ssh/tower_root.pub: No such file or directory
root@Tower:~#
Linux 4.18.20-unRAID.
root@mitchsserver:~# ssh-keygen -t rsa -b 2048 -f /boot/config/ssh/mitchsserver_root
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /boot/config/ssh/mitchsserver_root.
Your public key has been saved in /boot/config/ssh/mitchsserver_root.pub.
The key fingerprint is:
SHA256:1Yrjc15G7yqzI7OlQgjOZnGlidqNRvAWioFyog26Gv0 root@mitchsserver
The key's randomart image is:
+---[RSA 2048]----+
|.                |
|B o   .    .     |
|=X o +    . .    |
|= O +    o .     |
| X * .  S . .    |
|+ X o .. . . .   |
|.= . .  o o o .  |
|.   E . o*+o .   |
|       .o+o=...  |
+----[SHA256]-----+
root@mitchsserver:~# scp /boot/config/ssh/mitchsserver_root.pub tower:/boot/config/ssh
The authenticity of host 'tower (192.168.0.3)' can't be established.
ECDSA key fingerprint is SHA256:UKYZDUj3u5hrVwR7Ib1GHznjiNQnj7XyzSdlchQuXz8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'tower,192.168.0.3' (ECDSA) to the list of known hosts.
root@tower's password:
mitchsserver_root.pub                                                                      100%  399     1.0MB/s   00:00
root@mitchsserver:~# mkdir -p /root/.ssh
root@mitchsserver:~#

 

Link to comment

and when I try to follow that other article one you also linked..  I cant get $  or if statesments to work 

 

$ if [ ! -d .ssh ]; then mkdir .ssh ; chmod 700 .ssh ; fi 

$ mv Tower-rsync-key.pub .ssh/

$ cd .ssh/ $ if [ ! -f authorized_keys ]; then touch authorized_keys ; chmod 600 authorized_keys ; fi

$ cat Tower-rsync-key.pub >> authorized_keys 

Link to comment

I trying step by step slowly... I also find the cat file cant view the file I guess it takes the info in nad put its to authorized keys  it doesn't see the files  even if its there 

Linux 4.18.20-unRAID.
Last login: Sat Mar  2 12:17:11 -0500 2019 on pts/1 from 192.168.0.3.
root@mitchsserver:~# ssh-keygen -t rsa -b 2048 -f /boot/config/ssh/mitchsserver_root
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /boot/config/ssh/mitchsserver_root.
Your public key has been saved in /boot/config/ssh/mitchsserver_root.pub.
The key fingerprint is:
SHA256:QL1QPHvScM9wTqxoNwzcrw5RwNCzWip2PYazjiD1+ys root@mitchsserver
The key's randomart image is:
+---[RSA 2048]----+
|      oOoo .     |
|     .. @ = +    |
|      .. # X     |
|       .X B =    |
|  .    BS= o     |
| . .o * = .      |
|. ...o + +       |
| . .Eo.   .      |
|    o++.         |
+----[SHA256]-----+
root@mitchsserver:~# ssh-keygen -t rsa -b 2048 -f /boot/config/ssh/mitchsserver_root
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /boot/config/ssh/mitchsserver_root.
Your public key has been saved in /boot/config/ssh/mitchsserver_root.pub.
The key fingerprint is:
SHA256:f7wQRIlL4c467BcIbakFuuJiaDFO8PtxlYQt7QsG5zA root@mitchsserver
The key's randomart image is:
+---[RSA 2048]----+
|        .o..     |
|    .  =o..      |
|   .Eo+o=..      |
|. . .*=*.o       |
|.. . =+.S .      |
|.+o .o.+.o o     |
|=.o.. = ..o o    |
|o=.  + ..  o .   |
|+  .. ..    .    |
+----[SHA256]-----+
root@mitchsserver:~# cd root
-bash: cd: root: No such file or directory
root@mitchsserver:~# cd /root
root@mitchsserver:~# ls
mdcmd@
root@mitchsserver:~# mkdir .ssh/
mkdir: cannot create directory ‘.ssh/’: File exists
root@mitchsserver:~# mkdir .ssh
mkdir: cannot create directory ‘.ssh’: File exists
root@mitchsserver:~# mkdir /root/.ssh/
mkdir: cannot create directory ‘/root/.ssh/’: File exists
root@mitchsserver:~# ls /root/.ssh/\
> ls /root/.ssh/
/bin/ls: cannot access '/root/.ssh/ls': No such file or directory
/root/.ssh/:
known_hosts
root@mitchsserver:~# cp /boot/config/ssh/tower_root /root/.ssh/id_rsa
root@mitchsserver:~# cat /boot/config/ssh/tower_root.pub > /root/.ssh/authorized_keys
cat: /boot/config/ssh/tower_root.pub: No such file or directory
root@mitchsserver:~# cat /boot/config/ssh/tower_root.pub
cat: /boot/config/ssh/tower_root.pub: No such file or directory
root@mitchsserver:~# cd /boot/config/ssh
root@mitchsserver:/boot/config/ssh# ls
mitchsserver_root*      ssh_host_dsa_key.pub*    ssh_host_ed25519_key*      ssh_host_rsa_key.pub*
mitchsserver_root.pub*  ssh_host_ecdsa_key*      ssh_host_ed25519_key.pub*  tower_root*
ssh_host_dsa_key*       ssh_host_ecdsa_key.pub*  ssh_host_rsa_key*          tower_root.pub*
root@mitchsserver:/boot/config/ssh# cat tower_root.pub
cat: tower_root.pub: No such file or directory
root@mitchsserver:/boot/config/ssh# cat mitchsserver_root.pub
cat: mitchsserver_root.pub: No such file or directory
root@mitchsserver:/boot/config/ssh# cat
aa
aa


^C
root@mitchsserver:/boot/config/ssh# ls
mitchsserver_root*      ssh_host_dsa_key.pub*    ssh_host_ed25519_key*      ssh_host_rsa_key.pub*
mitchsserver_root.pub*  ssh_host_ecdsa_key*      ssh_host_ed25519_key.pub*  tower_root*
ssh_host_dsa_key*       ssh_host_ecdsa_key.pub*  ssh_host_rsa_key*          tower_root.pub*
root@mitchsserver:/boot/config/ssh#

 

Link to comment

@ken-ji  relooking at this  I think the tower_key  1 needs to be  tower_root  but be tower_root.pub

 

# scp /boot/config/ssh/mitchsserver_root.pub tower:/boot/config/ssh

Again here.

 

Then add this to tower go file

mkdir -p /root/.ssh

cp /boot/config/ssh/tower_key /root/.ssh/id_rsa

cat /boot/config/ssh/mitchsserver_key.pub > /root/.ssh/authorized_keys

chmod g-rwx,o-rwx -R /root/.ssh

 

and the mitchsserver go file

 

mkdir -p /root/.ssh

cp /boot/config/ssh/tower_key /root/.ssh/id_rsa

cat /boot/config/ssh/mitchsserver_key.pub > /root/.ssh/authorized_keys

chmod g-rwx,o-rwx -R /root/.ssh

 

 

but I no expert.. but they both the same should the tower go file be 

mkdir -p /root/.ssh

cp /boot/config/ssh/tower_root.pub /root/.ssh/id_rsa

cat /boot/config/ssh/mitchsserver_key.pub > /root/.ssh/authorized_keys

chmod g-rwx,o-rwx -R /root/.ssh

 

and should mitchsserver be

mkdir -p /root/.ssh

cp /boot/config/ssh/mitchsserver_root.pub /root/.ssh/id_rsa

cat /boot/config/ssh/tower_root.pub > /root/.ssh/authorized_keys

chmod g-rwx,o-rwx -R /root/.ssh

 

 

I no expert  so im just guessing now  

Link to comment

Sorry if you've gotten confused. I sometimes have typos in my instructions

what you want to do is:

  • generate a private key and public key (by default they are id_rsa and id_rsa.pub)
  • the ssh-keygen command specifies the name of the private key - so:
    • tower: /boot/config/ssh/tower_root and /boot/config/tower_root.pub
    • mitchsserver: /boot/config/ssh/mitchsserver_root and /boot/config/ssh/mitchsserver_root.pub
  • you need the public key of each server to be on the other server so:
    • on tower: scp /boot/config/ssh/tower_root.pub mitchsserver:/boot/config/ssh
    • on mitchsserver: scp /boot/config/ssh/mitchsserver_root.pub tower:/boot/config/ssh

  • you want to copy them from the usb to ram so (example: tower)
    • private key: cp /boot/config/ssh/tower_root /root/.ssh/id_rsa
    • public key: cp /boot/config/ssh/mitchsserver_root.pub /root/.ssh/authorized_keys
    • then ensure correct file permissions: chmod g-rwx,o-rwx -R /root/.ssh

At this point ssh must work without passwords

You are already there. just review these instructions versus what you did.

Afterwards, we just install the last 3 commands to the go file to make it persist over reboots.

Link to comment

@ken-jiso whats a private key then for  and how come you don't need to copy it..  so here is the procedure I did... and the ssh tower echo hello what is that really doing 

 

Tower
------
    ssh-keygen -t rsa -b 2048 -f /boot/config/ssh/tower_root
    scp /boot/config/ssh/tower_root.pub mitchsserver:/boot/config/ssh


Mitchs Server
-----------------
    ssh-keygen -t rsa -b 2048 -f /boot/config/ssh/mitchsserver_root
    scp /boot/config/ssh/mitchsserver_root.pub tower:/boot/config/ssh


Tower
=========
    mkdir -p /root/.ssh
    cp /boot/config/ssh/tower_root.pub /root/.ssh/id_rsa
    cat /boot/config/ssh/mitchsserver_root.pub > /root/.ssh/authorized_keys
    chmod g-rwx,o-rwx -R /root/.ssh

Mitchs Server
--------------
    mkdir -p /root/.ssh
    cp /boot/config/ssh/mitchsserver_root.pub /root/.ssh/id_rsa
    cat /boot/config/ssh/tower_root.pub > /root/.ssh/authorized_keys
    chmod g-rwx,o-rwx -R /root/.ssh

 

 

Linux 4.18.20-unRAID.
Last login: Sat Mar  2 20:27:46 -0500 2019 on /dev/pts/0.
root@Tower:~# ssh-keygen -t rsa -b 2048 -f /boot/config/ssh/tower_root
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /boot/config/ssh/tower_root.
Your public key has been saved in /boot/config/ssh/tower_root.pub.
The key fingerprint is:
SHA256:I4o8AOgsBUjLaRL5Hmeb3e+3QyEzucdz/qoRQKqfa/A root@Tower
The key's randomart image is:
+---[RSA 2048]----+
|=o        .      |
|=oo      o       |
|+*.     . ..     |
|*.o o  .  =..    |
|o+ + +o.S  *..   |
|.o..o.oo.o. =..  |
|  + .  oo. o.+   |
|   .    E.. o..  |
|       .....o+.o.|
+----[SHA256]-----+
root@Tower:~# scp /boot/config/ssh/tower_root.pub mitchsserver:/boot/config/ssh
The authenticity of host 'mitchsserver (192.168.0.244)' can't be established.
ECDSA key fingerprint is SHA256:APbRWv8D+cAMRGW1g4XnvufCGR/6hSe/lsk07JMVdSQ.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'mitchsserver,192.168.0.244' (ECDSA) to the list of known hosts.
root@mitchsserver's password:
tower_root.pub                                                                                    100%  392     1.4MB/s   00:00
root@Tower:~# mkdir -p /root/.ssh
root@Tower:~# cp /boot/config/ssh/tower_root.pub /root/.ssh/id_rsa
root@Tower:~# cat /boot/config/ssh/mitchsserver_key.pub > /root/.ssh/authorized_keys
cat: /boot/config/ssh/mitchsserver_key.pub: No such file or directory
root@Tower:~# cat /boot/config/ssh/mitchsserver_root.pub > /root/.ssh/authorized_keys
root@Tower:~# chmod g-rwx,o-rwx -R /root/.ssh
root@Tower:~# ssh mitchsserver echo Hello
Load key "/root/.ssh/id_rsa": invalid format
root@mitchsserver's password:
Hello
root@Tower:~# ^C
root@Tower:~#
Linux 4.18.20-unRAID.
Last login: Sat Mar  2 17:18:47 -0500 2019 on /dev/pts/3.
root@mitchsserver:~# ssh-keygen -t rsa -b 2048 -f /boot/config/ssh/mitchsserver_root
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /boot/config/ssh/mitchsserver_root.
Your public key has been saved in /boot/config/ssh/mitchsserver_root.pub.
The key fingerprint is:
SHA256:iTOOMaAlvvrq7DfMDcE8u5onI2gZwZlIkcq+XHWzji8 root@mitchsserver
The key's randomart image is:
+---[RSA 2048]----+
| .o              |
| o               |
|B B              |
|+X * . + .       |
|o.. B = S        |
| o.+ = +         |
|o.B = +          |
|=B.B E .         |
|BOB . o.         |
+----[SHA256]-----+
root@mitchsserver:~# scp /boot/config/ssh/mitchsserver_root.pub tower:/boot/config/ssh
The authenticity of host 'tower (192.168.0.3)' can't be established.
ECDSA key fingerprint is SHA256:UKYZDUj3u5hrVwR7Ib1GHznjiNQnj7XyzSdlchQuXz8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'tower,192.168.0.3' (ECDSA) to the list of known hosts.
root@tower's password:
mitchsserver_root.pub                                                                                               100%  399     1.2MB/s   00:00
root@mitchsserver:~# mkdir -p /root/.ssh
root@mitchsserver:~# cp /boot/config/ssh/mitchsserver_root.pub /root/.ssh/id_rsa
root@mitchsserver:~# cat /boot/config/ssh/tower_root.pub > /root/.ssh/authorized_keys
root@mitchsserver:~# chmod g-rwx,o-rwx -R /root/.ssh
root@mitchsserver:~# ssh tower echo Hello
Load key "/root/.ssh/id_rsa": invalid format
root@tower's password:
Hello
root@mitchsserver:~#

 

Link to comment

and i tried running my script file  

but it askes for a password  and says its invalid too... so guess there is more to do 

Linux 4.18.20-unRAID.
Last login: Sat Mar  2 17:22:29 -0500 2019 on /dev/pts/0.
root@mitchsserver:~# rsync -avzu -s --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"  root@tower:/mnt/user/Videos/ /mnt/user/Videos/
Load key "/root/.ssh/id_rsa": invalid format
root@tower's password:
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(642) [Receiver=3.1.3]
root@mitchsserver:~# cd /root/.ssh
root@mitchsserver:~/.ssh# ls
authorized_keys  id_rsa*  known_hosts
root@mitchsserver:~/.ssh#

 

Link to comment

quick explanation of Private and Public Keys.

Private key is what you have to prove that you are the user (root in our situation)

Public key is something you publish so others can use to determine who you are without needing the private key

so when you SSH to a server, the server responds with a block of data which is a this session-only encryption key - encrypted using your public key (in the authorized_keys file), which your ssh client will then decrypt with your private key. Upon success, the ssh client will use the decrypted session key to talk to the server, which the server will take as proof that you are authorized to be the user.

You can think of the private and public key system as a one way lock. if I lock (encrypt) with the public key, only the private key can decrypt it.

 

2 minutes ago, comet424 said:

and i tried running my script file  

but it askes for a password  and says its invalid too... so guess there is more to do 


Linux 4.18.20-unRAID.
Last login: Sat Mar  2 17:22:29 -0500 2019 on /dev/pts/0.
root@mitchsserver:~# rsync -avzu -s --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"  root@tower:/mnt/user/Videos/ /mnt/user/Videos/
Load key "/root/.ssh/id_rsa": invalid format
root@tower's password:
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(642) [Receiver=3.1.3]
root@mitchsserver:~# cd /root/.ssh
root@mitchsserver:~/.ssh# ls
authorized_keys  id_rsa*  known_hosts
root@mitchsserver:~/.ssh#

remove the 

Sorry I didn't the little problem, ssh does something weird with executable keys (see the * on the id_rsa when you did the ls)

change the chmod command to chmod 0600 /root/.ssh/id_rsa

run the Hello test again and it should not ask for password.

Edited by ken-ji
Link to comment

@ken-ji didn't work. 😞  this shit is frustrating as frig...  man maybe I should have learned more Red Hat  back 20 yrs ago in college  maybe I be better at this stuff..  I was Dos Windows and Visual Basic (for programming )

 

so what does the 600 mean in the chmod.. im guessing Chmod is the same as a dos Attribute rights

 

Linux 4.18.20-unRAID.
Last login: Sat Mar  2 20:28:31 -0500 2019 on /dev/pts/0.
root@Tower:~# chmod 0600 /root/.ssh/id_rsa
root@Tower:~# ssh mitchsserver echo Hello
Load key "/root/.ssh/id_rsa": invalid format
root@mitchsserver's password:
Hello
root@Tower:~#


 

Link to comment

Sorry - I must be sleepy but you need to copy the private key into the id_rsa file not the public key

root@mitchsserver:~# cp /boot/config/ssh/mitchsserver_root.pub /root/.ssh/id_rsa

should be

root@mitchsserver:~# cp /boot/config/ssh/mitchsserver_root /root/.ssh/id_rsa

 

same for tower.

Link to comment

@ken-ji I think it worked this time...  and don't worry your more expert then ill ever be  I so new to it and im a visual learner  not a text learner  dyslexia gets the best of me...    and I  used the other chmod  and it worked...  but what does that mean chmod 500 600 700 I seen??

I saving all this is a text file so if I ever have to redue  the procedures will be easy.. as I been spoiled with Gui Based Windows lol  and I used to write command line stuff when I programmed in Visual Basic to do  some command line stuff... not used to a lot lol

 

 

Linux 4.18.20-unRAID.
Last login: Sat Mar  2 17:38:47 -0500 2019 on /dev/pts/0.
root@mitchsserver:~# mkdir -p /root/.ssh
root@mitchsserver:~# cp /boot/config/ssh/mitchsserver_root /root/.ssh/id_rsa
root@mitchsserver:~# cat /boot/config/ssh/tower_root.pub > /root/.ssh/authorized_keys
root@mitchsserver:~# chmod g-rwx,o-rwx -R /root/.ssh
root@mitchsserver:~# ssh tower echo Hello
Hello
root@mitchsserver:~#
Linux 4.18.20-unRAID.
Last login: Sat Mar  2 20:59:11 -0500 2019 on /dev/pts/0.
root@Tower:~# mkdir -p /root/.ssh
root@Tower:~# cp /boot/config/ssh/tower_root /root/.ssh/id_rsa
root@Tower:~# cat /boot/config/ssh/mitchsserver_root.pub > /root/.ssh/authorized_keys
root@Tower:~# chmod g-rwx,o-rwx -R /root/.ssh
root@Tower:~# ssh mitchsserver echo Hello
Hello
root@Tower:~#

 

Link to comment

so what does chmod 777 mean

and it didn't work... once i type yes it starts... when i reboot back to gotting type yes again  tried 3 times

Linux 4.18.20-unRAID.
Last login: Sat Mar  2 18:21:23 -0500 2019 on /dev/pts/0.
root@mitchsserver:~# rsync -avzu -s --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"  root@tower:/mnt/user/Documents/ /mnt/user/Mikes\ Files/Documents/
The authenticity of host 'tower (192.168.0.3)' can't be established.
ECDSA key fingerprint is SHA256:UKYZDUj3u5hrVwR7Ib1GHznjiNQnj7XyzSdlchQuXz8.
Are you sure you want to continue connecting (yes/no)?


Linux 4.18.20-unRAID.
root@Tower:~# rsync -avzu -s --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"  /mnt/user/Documents/ root@mitchsserver:/mnt/user/Mikes\ Files/Documents/
The authenticity of host 'mitchsserver (192.168.0.244)' can't be established.
ECDSA key fingerprint is SHA256:APbRWv8D+cAMRGW1g4XnvufCGR/6hSe/lsk07JMVdSQ.
Are you sure you want to continue connecting (yes/no)?

 

Link to comment

so does that mean I wanna do chmod 777 after a rysnc  as I find if I copy or had rysnc  I had to no rights to delete or move files in windows from folders

have to do every couple days or so  the new permissions   to all    cuz when I move files from windows to the unraid I don't have rights to change it later it seems

Linux 4.18.20-unRAID.
root@Tower:~# rsync -avzu -s --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"  /mnt/user/Documents/ root@mitchsserver:/mnt/user/Mikes\ Files/Documents/
The authenticity of host 'mitchsserver (192.168.0.244)' can't be established.
ECDSA key fingerprint is SHA256:APbRWv8D+cAMRGW1g4XnvufCGR/6hSe/lsk07JMVdSQ.
Are you sure you want to continue connecting (yes/no)? ^Crsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(642)[sender=3.1.3]
root@Tower:~# ls -l /root/.ssh
total 8
-rw------- 1 root root  399 Mar  2 21:23 authorized_keys
-rwx------ 1 root root 1823 Mar  2 21:23 id_rsa*
root@Tower:~#

Linux 4.18.20-unRAID.
Last login: Sat Mar  2 18:21:23 -0500 2019 on /dev/pts/0.
root@mitchsserver:~# rsync -avzu -s --stats --numeric-ids --progress -e "ssh -i /root/.ssh/id_rsa -T -o Compression=no -x"  root@tower:/mnt/user/Documents/ /mnt/user/Mikes\ Files/Documents/
The authenticity of host 'tower (192.168.0.3)' can't be established.
ECDSA key fingerprint is SHA256:UKYZDUj3u5hrVwR7Ib1GHznjiNQnj7XyzSdlchQuXz8.
Are you sure you want to continue connecting (yes/no)? ^X^Crsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(642) [Receiver=3.1.3]root@mitchsserver:~# ls -l /root/.ssh
total 8
-rw------- 1 root root  392 Mar  2 18:21 authorized_keys
-rwx------ 1 root root 1823 Mar  2 18:21 id_rsa*
root@mitchsserver:~#

 

go file Tower

-------------------


# Copy SSH files back to /root/.ssh folder and set permissions for files
    mkdir -p /root/.ssh
    cp /boot/config/ssh/tower_root /root/.ssh/id_rsa
    cat /boot/config/ssh/mitchsserver_root.pub > /root/.ssh/authorized_keys
    chmod g-rwx,o-rwx -R /root/.ssh

#!/bin/bash
# Start the Management Utility
/usr/local/sbin/emhttp &

 

 

 

 

go file Mitchsserver

--------------------------

#!/bin/bash
# Start the Management Utility
/usr/local/sbin/emhttp &


#Mitchs Server Copy SSH    
    mkdir -p /root/.ssh
    cp /boot/config/ssh/mitchsserver_root /root/.ssh/id_rsa
    cat /boot/config/ssh/tower_root.pub > /root/.ssh/authorized_keys
    chmod g-rwx,o-rwx -R /root/.ssh

 

 

 

 

 

and what is this /usr/local/sbin/emhttp &    I know when I remed it out I couldn't access the server at all  no shares or webgui  and does it matter which is first 

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.