Difference between revisions of "Rocky Access SSH"
(4 intermediate revisions by one other user not shown) | |||
Line 3: | Line 3: | ||
On Linux or Mac, the OpenSSH command-line utilities are generally installed by default. | On Linux or Mac, the OpenSSH command-line utilities are generally installed by default. | ||
As of Windows 10, Microsoft has made available the Terminal app with OpenSSH tools to install.<br/> | |||
As of Windows 11, the terminal app and tools are installed by default.<br/> | |||
With the terminal app, all the commands in this document work but referencing files and paths will be slightly different. | |||
= Generate Key Pair = | = Generate Key Pair = | ||
Line 27: | Line 29: | ||
</pre> | </pre> | ||
<span style='color: red'>Keep your private key file and contents safe and do not share them.</span> | |||
= Connecting to Rocky = | = Connecting to Rocky = | ||
Line 50: | Line 53: | ||
[[File:Rocky copy linuxmac.gif|thumb|SEE IT IN ACTION]] | [[File:Rocky copy linuxmac.gif|thumb|SEE IT IN ACTION]] | ||
To copy files from remote systems through SCP we use the scp command. It is very much like the cp command except you can specify remote machines as the source or destination of the file. | To copy files from remote systems through SCP we use the <code>scp</code> command. It is very much like the cp command except you can specify remote machines as the source or destination of the file. | ||
<pre> | <pre> | ||
Line 63: | Line 66: | ||
The colon is required. If you leave newfilename blank then it will default to the same filename given in the other parameters. | The colon is required. If you leave newfilename blank then it will default to the same filename given in the other parameters. | ||
For example, to copy | For example, if you are '''test_user''' and you want to copy a file on your local machine named '''localfile''' to your home directory on Rocky you could do the following: | ||
<pre> | |||
scp localfile test_user@rocky.nimbios.org: | |||
</pre> | |||
Leaving the filename part blank after the colon means to use the same filename. | |||
Likewise, to copy a file named '''rockyfile''' from your Rocky home directory to your local machine: | |||
<pre> | |||
scp test_user@rocky.nimbios.org:rockyfile . | |||
</pre> | |||
In this case, using a . means copy it to the current directory. | |||
Latest revision as of 15:05, 19 April 2023
SSH Software
On Linux or Mac, the OpenSSH command-line utilities are generally installed by default.
As of Windows 10, Microsoft has made available the Terminal app with OpenSSH tools to install.
As of Windows 11, the terminal app and tools are installed by default.
With the terminal app, all the commands in this document work but referencing files and paths will be slightly different.
Generate Key Pair
Open a terminal and type the following command:
ssh-keygen
You will be prompted where to save your private key. Just hitting enter will save it to the default location. You will also be prompted to enter a password. This password will be required to use your private key in the future.
Default Private Key Location | ~/.ssh/id_rsa |
Default Public Key Location | ~/.ssh/id_rsa.pub |
Assuming default location, output your public key with the following command:
cat ~/.ssh/id_rsa.pub
Keep your private key file and contents safe and do not share them.
Connecting to Rocky
To connect to a Rocky shell you will use the ssh command on the edge node: rocky.nimbios.org
The format for the ssh command is:
ssh -i <myprivatekeyfile> <username>@<hostname>
If you set a password on your private key, you will be prompted for it.
If your private key file is in the default location, the ssh utilities will know to look there for it making the command just the following:
ssh <username>@<hostname>
Upload/Download Files
To copy files from remote systems through SCP we use the scp
command. It is very much like the cp command except you can specify remote machines as the source or destination of the file.
scp -i <myprivatekeyfile> <from> <to>
To specify a remote location, you would use the format
<username>@<hostname>:[filename]
The colon is required. If you leave newfilename blank then it will default to the same filename given in the other parameters.
For example, if you are test_user and you want to copy a file on your local machine named localfile to your home directory on Rocky you could do the following:
scp localfile test_user@rocky.nimbios.org:
Leaving the filename part blank after the colon means to use the same filename.
Likewise, to copy a file named rockyfile from your Rocky home directory to your local machine:
scp test_user@rocky.nimbios.org:rockyfile .
In this case, using a . means copy it to the current directory.