You have already posted another question another question on this same topic two weeks later, with a better solution using GNU parallel. I'll review this one too anyway on its own merit, though it might be a bit of a moot point.
It's not a good idea to set StrictHostKeyChecking=no
when using ssh
.
The host key of servers should normally not change.
When they do, and you don't know why,
it might be a man in the middle attack.
If it's part of a scheduled server update,
you can manually update the ~/.ssh/known_hosts
file accordingly.
When filtering the output of ls
like this:
ls -dt1 path | head -n1
you don't need the -1
flag.
The purpose of that flag is to print the list of files in a single column.
But when you pipe the output to another command,
the output will be always a single column.
Instead of this:
if [ "$dir1" = "$dir2" ]
This is easier (because you don't need to quote the variables) and more modern:
if [[ $dir1 = $dir2 ]]
Instead of cramming so many ssh
options on the command line:
scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 david@machineA:...
it's better to add these options in the ~/.ssh/config
file, like this:
Host machineA
Hostname machineA
User david
ControlMaster auto
ControlPath ~/.ssh/control-%r@%h:%p
ControlPersist 900
This way the scp
command becomes simply:
scp machineA:...
I hope this (and even more, my other answer my other answer) helps!
You have already posted another question on this same topic two weeks later, with a better solution using GNU parallel. I'll review this one too anyway on its own merit, though it might be a bit of a moot point.
It's not a good idea to set StrictHostKeyChecking=no
when using ssh
.
The host key of servers should normally not change.
When they do, and you don't know why,
it might be a man in the middle attack.
If it's part of a scheduled server update,
you can manually update the ~/.ssh/known_hosts
file accordingly.
When filtering the output of ls
like this:
ls -dt1 path | head -n1
you don't need the -1
flag.
The purpose of that flag is to print the list of files in a single column.
But when you pipe the output to another command,
the output will be always a single column.
Instead of this:
if [ "$dir1" = "$dir2" ]
This is easier (because you don't need to quote the variables) and more modern:
if [[ $dir1 = $dir2 ]]
Instead of cramming so many ssh
options on the command line:
scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 david@machineA:...
it's better to add these options in the ~/.ssh/config
file, like this:
Host machineA
Hostname machineA
User david
ControlMaster auto
ControlPath ~/.ssh/control-%r@%h:%p
ControlPersist 900
This way the scp
command becomes simply:
scp machineA:...
I hope this (and even more, my other answer) helps!
You have already posted another question on this same topic two weeks later, with a better solution using GNU parallel. I'll review this one too anyway on its own merit, though it might be a bit of a moot point.
It's not a good idea to set StrictHostKeyChecking=no
when using ssh
.
The host key of servers should normally not change.
When they do, and you don't know why,
it might be a man in the middle attack.
If it's part of a scheduled server update,
you can manually update the ~/.ssh/known_hosts
file accordingly.
When filtering the output of ls
like this:
ls -dt1 path | head -n1
you don't need the -1
flag.
The purpose of that flag is to print the list of files in a single column.
But when you pipe the output to another command,
the output will be always a single column.
Instead of this:
if [ "$dir1" = "$dir2" ]
This is easier (because you don't need to quote the variables) and more modern:
if [[ $dir1 = $dir2 ]]
Instead of cramming so many ssh
options on the command line:
scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 david@machineA:...
it's better to add these options in the ~/.ssh/config
file, like this:
Host machineA
Hostname machineA
User david
ControlMaster auto
ControlPath ~/.ssh/control-%r@%h:%p
ControlPersist 900
This way the scp
command becomes simply:
scp machineA:...
I hope this (and even more, my other answer) helps!
You have already posted another question on this same topic two weeks later, with a better solution using GNU parallel. I'll review this one too anyway on its own merit, though it might be a bit of a moot point.
It's not a good idea to set StrictHostKeyChecking=no
when using ssh
.
The host key of servers should normally not change.
When they do, and you don't know why,
it might be a man in the middle attack.
If it's part of a scheduled server update,
you can manually update the ~/.ssh/known_hosts
file accordingly.
When filtering the output of ls
like this:
ls -dt1 path | head -n1
you don't need the -1
flag.
The purpose of that flag is to print the list of files in a single column.
But when you pipe the output to another command,
the output will be always a single column.
Instead of this:
if [ "$dir1" = "$dir2" ]
This is easier (because you don't need to quote the variables) and more modern:
if [[ $dir1 = $dir2 ]]
Instead of cramming so many ssh
options on the command line:
scp -o ControlMaster=auto -o 'ControlPath=~/.ssh/control-%r@%h:%p' -o ControlPersist=900 david@machineA:...
it's better to add these options in the ~/.ssh/config
file, like this:
Host machineA
Hostname machineA
User david
ControlMaster auto
ControlPath ~/.ssh/control-%r@%h:%p
ControlPersist 900
This way the scp
command becomes simply:
scp machineA:...
I hope this (and even more, my other answer) helps!