Export network connections

Any wishes
Post Reply
User avatar
ponyspy
Posts: 74
Joined: Thu May 18, 2017 3:51 pm
Location: Moscow

Export network connections

Post by ponyspy » Tue Apr 12, 2022 8:09 pm

Hi! What about to make feature for export all network connections to CSV format and import in this format. (even with passwords)

It's not secure, but very convenient for move configuration between machines.

Thank you!

User avatar
mike
Posts: 985
Joined: Thu Jul 16, 2015 5:35 am
Location: Exeter, UK

Re: Export network connections

Post by mike » Sat May 14, 2022 11:58 am

Hey,
It's possible to implement this functionality without changing NC itself.
A relatively straightforward Python script could traverse a JSON in "~/Library/Application Support/Nimble Commander/Config/NetworkConnections.json", gather the connections and their names, and then find the according passwords in Keychain Access.
It's unlikely I'll add this directly to NC anytime soon.

JayB
Posts: 188
Joined: Sun Jan 08, 2017 4:38 pm

Re: Export network connections

Post by JayB » Mon Oct 24, 2022 9:15 am

I would just copy NC's NetworkConnetions.json to the other Mac, and sync (or copy) the login.keychain.

A script would probably need to look something like this:

Code: Select all

#!/bin/zsh

csvloc="$HOME/ncconns.csv"
echo "#id,type,title,uuid,user,host,ftp path,sftp keypath,network share,local mountpoint,port,network share proto" > "$csvloc"
conncount=0
while read -r ctype ctitle cuuid cuser chost cpath ckeypath cshare cmountpoint cport cproto ; do
	((conncount++))
	echo "$conncount,${ctype},${ctitle},${cuuid},${cuser},${chost},${cpath},${ckeypath},${cshare},${cmountpoint},${cport},${cproto}" >> "$csvloc"
done < <(jq --raw-output '.connections[] | "\(.type) \(.title) \(.uuid) \(.user) \(.host) \(.path) \(.keypath) \(.share) \(.mountpoint) \(.port) \(.proto)"' < "$HOME/Library/Application Support/Nimble Commander/Config/NetworkConnections.json")
Reading the passwords from the keychain is possible, of course, but you'd have to type in your admin password twice for every entry, which is a pita if you have a lot of NC connections stored.

However, what Nimble Commander could do differently, is to use its own keychain file instead of the login.keychain. Then users could easily transfer connection passwords to a new Mac while at the same time being able to start with a fresh login.keychain.

Post Reply