Giving AI SSH access
I let Claude SSH into my devices, and realised I had no idea what it actually did. Here’s how I scoped, logged and secured the whole process.
3 posts tagged Ssh
In /etc/fstab, be sure to add the option:
_netdev
As it will attempt to start the network mounted sshfs before networking has been started.
The entire line looks like this:
user@host:/some/dir /local/path fuse.sshfs defaults,idmap=user,_netdev 0 0
From the man pages:
_netdev
The filesystem resides on a device that requires network access (used to prevent the system from attempting to mount these filesystems until the network has been enabled on the system).
My own simple rsync backup ‘script’.
You’ll need a rsync server, something to backup, and ssh-agent running to ease the process (or, fill in your password each time).
Add the following lines (using a terminal text editor) to a text file (".rsync" for example, hidden files under Unix-like systems), and chmod +x $file.
rsync --archive -uv --exclude-from=/home/you/.rsync_exclude \
--rsh="ssh -p 222" --delete --stats --progress /Users/you/Documents/ \
you@remost.host.com:/home/you/remote-backup-directory
This will upload any files in /Users/you/Documents to /home/you/remote-backup-directory.