Open main menu

Changes

User:Troels Emtekær Linnet

977 bytes added, 15:27, 28 November 2015
This should bring you to the google server.
<source lang="textbash">
lscpu
cat $HOME/.ssh/authorized_keys
The ssh command was
<source lang="textbash">
gcloud compute --project "relax-1143" ssh --zone "europe-west1-c" "relax"
</source>
We make a test file and copy it
<source lang="textbash">
touch test.txt
gcloud compute --project "relax-1143" copy-files test.txt relax:~ --zone "europe-west1-c"
gcloud compute --project "relax-1143" copy-files relax:~/testdir . --zone "europe-west1-c"
</source>
 
=== ssh-config with gcloud ===
See https://cloud.google.com/sdk/gcloud/reference/compute/config-ssh
 
gcloud compute config-ssh makes SSHing to virtual machine instances easier by adding an alias for each instance to the user SSH configuration (~/.ssh/config) file.
 
<source lang="bash">
gcloud compute --project "relax-1143" config-ssh
cat $HOME/.ssh/config
 
# ssh in
ssh relax.europe-west1-c.relax-1143
 
# Use sed to change value
grep 'relax.europe-west1-c.relax-1143' $HOME/.ssh/config
sed 's/relax.europe-west1-c.relax-1143/gcc_relax/g' $HOME/.ssh/config
sed -i.bak 's/relax.europe-west1-c.relax-1143/gcc_relax/g' $HOME/.ssh/config
ls -l $HOME/.ssh/config*
grep 'gcc_relax' $HOME/.ssh/config
ssh gcc_relax
</source>
 
=== Use scp and rsync ===
 
{{#tag:source|
#First fast check
touch test2.txt
scp test2.txt gcc_relax:
ssh gcc_relax
ls
exit
 
# Or use rsync
mkdir dirtest
rsync --progress -avzhe ssh ./dirtest gcc_relax:
ssh gcc_relax
ls
rmdir dirtest
exit
|lang="bash"
}}