Firefox form auto-completion database is a SQLite file. You'll need to install
sqlite3 in order to access such databases. After doing that, you can run a SQL query against the database (replace
sqlite3 -header -column ~/.mozilla/firefox/PROFILE.NAME/formhistory.sqlite 'SELECT fieldname, value FROM moz_formhistory'
You can limit the search to values containing "123" by appending
WHERE value LIKE "%123%" after
The password database gets more tricky as the contents of it are encrypted and therefore it's easier to start Firefox using the copied profile folder. Copy
~/.mozilla/firefox/PROFILE.NAME from the remote side to the local side in
~/tmp-ff-prof (tar + scp + tar). Then, run:
firefox -no-remote -profile ~/tmp-ff-prof &
-no-remote takes away the need for closing all Firefox instances.
You might also be interested in Firefox Sync which allows you to share your passwords between profiles.