Possible to enable USB ssh?

I’ve got a Pi Zero 2W in my travel bag to tinker while I travel, but I’m discovering the difficulties of getting this little thing on a new wifi network without ethernet, monitor, and keyboard.

I’ve seen a number of posts addressing this, both DietPi and Raspbian, and understand the options to flash a new card and modify dietpi-wifi.txt or find a way to access wpa_supplicant and modify that. However, flashing a new card wipes anything I have setup, and my Mac doesn’t let me get to wpa_supplicant in the ext4 sector (though it seems like maybe some 3rd party paid software might enable this).

Is it possible to enable USB ssh with DietPi so I can access my Zero2 directly from my Mac with a USB cord, then add the wifi network? I tried the steps in (this blog post) on a fresh dietpi flash and it seemed to work, as an “Allow RNDIS/Ethernet Gadget” request popped up.

But then what? Of course it won’t be ‘ssh pi@raspberrypi.local’ like in that blog, I tried ‘root@dietpi.local’ and a couple similar variations with no luck.

Any ideas?

(Also open to alternative ideas of how to add my Zero2 with current configuration to a new wifi network with only a macbook, a usb cord, and a microSD reader.)

Yes, absolutely…you turn the device into a USB gadget rather than a device

https://www.isticktoit.net/?p=1383

Just look up RPi as a USB gadget for even more reading

If you just want access to the console you can use something like this:
https://www.berrybase.de/usb-ttl/uart/rs232-adapterkabel-mit-pl2303hx-chipsatz
Activate serial console in dietpi-config, connect the cable and then you can connect via Putty or similar app via a virtual com port.
Further info:
https://pbxbook.com/voip/sputty.html

The question is: What is the use case? What are you planning to do with the Zero 2? Do you want to connect to the WiFi of a hotel? Perhaps you can describe your scenario in more detail.

Yes, that’s just like the blog I linked, but both ssh to pi@raspberrypi.local … what’s the .local address for dietpi? I tried a few guesses and none worked

yes, I want to connect the Zero2 to other wifi such as hotel, airbnb, relative’s house, etc. I don’t always know the wifi credentials before arriving, so I can’t add them while still at home on my own network.

This is just user@hostname and I think the default hostname is DietPi.

# Hostname
AUTO_SETUP_NET_HOSTNAME=DietPi

The local adress depends on your network, if it got an IP via DHCP or if you set a static one.

I guess this is not workin in gadget mode, not sure which IP address is used in this case.

@brtravel what are you planning to do once connected to WiFi? because it could be a challange to access the device as you might not know the IP and some hotels might block communiction between device connected to hotel wifi.

Well in this scenario it’s not on any network yet, which is the whole difficulty, trying to give a headless device the wifi credentials when it’s not yet on any network. I assume like in that blogpost that using .local is the way to do this with USB SSH.

I’ll try again when I’m back at computer, I left the default settings on device name and I tried both root@dietpi.local and root@DietPi.local

I know it’s not connected to WiFi yet but still would be great to share what exactly you are planning once connected

yeah, that was a reply to Jappe who was suggesting using the IP set by DHCP or static, which in this case wouldn’t exist yet(?)

my use case is pretty open still, I got this Pi Zero 2 just to tinker and threw it in my minimalist travel bag and am currently visiting family and realized I’m unable to easily get it on the network. Tailscale, Pihole, and Samba likely.

Sounds like you want to set it up as a travel router
Video uses old methods…should work with dietpi as well

https://forums.raspberrypi.com/viewtopic.php?t=331775
There might also be RaspAP

Other options I have seen use OpenWRT… (and that opens a new can o’ worms!)

There are options to get to ext4 in MAC OS

But why moving the device with you? If you have installed Tailscale and Pihole, you could leave the device at home