Skip to content

Commit 7bbaf94

Browse files
committed
NEW: Include comment in generated ssh key
- add comment to key so that it's easier to attribute On branch main Changes to be committed: modified: client/setup.ps1 modified: client/setup.sh
1 parent 62cb805 commit 7bbaf94

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

client/setup.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ if (-not (Test-Path -Path $sshkey)) {
130130
if ($PSBoundParameters.Count -eq 0) {
131131
$ans = Read-Host "About to create and upload an ssh key to $headnode. You will be prompted for your cluster password. Press any key to continue "
132132
}
133-
ssh-keygen -q -f $sshkey -t ed25519 -N '""'
133+
ssh-keygen -q -f $sshkey -t ed25519 -C "vscode-remote-hpc@${env:COMPUTERNAME}" -N '""'
134134
if ($PSBoundParameters.Count -eq 0) {
135135
type "$sshkey.pub" | ssh $uname@$headnode "cat >> ~/.ssh/authorized_keys"
136136
}

client/setup.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,11 @@ if [ ! -f "${sshkey}" ]; then
114114
if [[ $# -eq 0 ]]; then
115115
read -p "About to create and upload an ssh key to ${headnode}. You will be prompted for your cluster password. Press any key to continue " ans </dev/tty
116116
fi
117-
ssh-keygen -q -f "${sshkey}" -t ed25519 -N ""
117+
machine="${HOST}"
118+
if [ -z "${machine}" ]; then
119+
machine="${HOSTNAME}"
120+
fi
121+
ssh-keygen -q -f "${sshkey}" -t ed25519 -C "vscode-remote-hpc@${machine}" -N ""
118122
if [[ $# -eq 0 ]]; then
119123
ssh-copy-id -i "${sshkey}" "${uname}@${headnode}"
120124
fi

0 commit comments

Comments
 (0)