Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions versioned_docs/version-v1.8/install/post-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,22 @@ By default during installation, SSH password authentication is enabled on the Ha
Once installation is completed, however, disabling SSH password authentication is recommended. You can run the following command, which uses `kubectl` to apply a [`CloudInit`](https://docs.harvesterhci.io/v1.6/advanced/cloudinitcrd/) configuration, to disable SSH password authentication on all Harvester nodes:

```sh
cat <<EOF | kubectl apply -f -
cat <<EOF | sudo env "PATH=$PATH" /var/lib/rancher/rke2/bin/kubectl --kubeconfig=/etc/rancher/rke2/rke2.yaml apply -f -

@votdev votdev Jul 13, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not simply use sudo su to become root, then you can execute kubectl without issues.

Please keep the previous text.

Suggested change
cat <<EOF | sudo env "PATH=$PATH" /var/lib/rancher/rke2/bin/kubectl --kubeconfig=/etc/rancher/rke2/rke2.yaml apply -f -
cat <<EOF | kubectl apply -f -

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my testing, kubectl wasn't in the root user's PATH.

apiVersion: node.harvesterhci.io/v1beta1
kind: CloudInit
metadata:
name: ssh-config
spec:
matchSelector:
matchSelector:
harvesterhci.io/managed: "true" # apply to all Harvester nodes
Comment thread
alexfornuto marked this conversation as resolved.
filename: 99-ssh-config
contents: |
stages:
network:
- name: "disable password login"
commands:
- sed -i -E 's/^#?PasswordAuthentication .*/PasswordAuthentication no/' /etc/ssh/sshd_config
- sed -i -E 's/^#?ChallengeResponseAuthentication .*/ChallengeResponseAuthentication no/' /etc/ssh/sshd_config
- sed -i -E 's/^#?UsePAM .*/UsePAM no/' /etc/ssh/sshd_config
- echo "PasswordAuthentication no" > /etc/ssh/sshd_config.d/99-disable-passwords.conf
- echo "KbdInteractiveAuthentication no" >> /etc/ssh/sshd_config.d/99-disable-passwords.conf
- systemctl restart sshd
paused: false
EOF
Expand Down