Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Access FileVault sparseimages via ssh UNIX
Sometimes you want to get a document off a computer that is using FileVault, only to find that after sshing in, all that is left of your user directory is a username.sparseimage file. All is not lost, you can still get to your files using the following command via the Terminal:
~here: ssh remotecomputer
Password:
~there: hdid -stdinpass /Users/username/username.sparseimage
You should now type in your password, but be careful when you do this, your password will be echoed in plaintext. Type in your password, and then null terminate it (hit control-V then Shift-Control-@), then hit Return, and then Control-D. Your user directory will then be mounted in /Volumes/username/ (not your ~username directory, for some reason).

If anyone knows a better way to do this, please comment, I looked on the net but could only find this in dutch on a newsgroup.
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[12,335 views]  

Access FileVault sparseimages via ssh | 11 comments | Create New Account
Click here to return to the 'Access FileVault sparseimages via ssh' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Access FileVault sparseimages via ssh
Authored by: aranor on Mar 04, '04 11:46:32AM
In 10.3, hdid really only exists for backwards compatibility, and you should use hdiutil instead. To mount it anywhere you want, try hdiutil -stdinpass attach /Users/username/username.sparseimage -mountpath /Users/username (Note that I haven't tried this, but the man pages say that's how you mount at a path outside of /Volumes)

[ Reply to This | # ]
Exactly as FileVault does it
Authored by: ajbaker on Dec 15, '05 04:16:30PM
After reading this entire thread, I was still left a little concerned. All of the tips result in the sparseimage being mounted as a device. This means the disk image is mounted on each users desktop with full write access! (Hardly a smart move.)

Thus I set about the quest of discovering exactly how FileVault does it. Surprisingly I couldn't find anything accurate online.

This however I think solves all the problems:

hdiutil attach /Users/username.sparseimage -stdinpass -owners on -mountpoint /Users/username -nobrowse

The differences are:
the disk image path has to go immediately after the verb attach;
-owners on specifies the permissions on the disk image should be respected;
-mountpoint is used instead of mountroot;
-nobrowse means the image is not mounted as a device in the Finder and thus not displayed in front of every user.

[ Reply to This | # ]

Access FileVault sparseimages via ssh
Authored by: pukku on Mar 04, '04 12:23:09PM

Although this still leaves your password in plaintext, you might avoid all the various key combinations as follows (untested, but it should work...)

echo "passwordhere" | hdutil -stdinpass ...

HTH,
Ricky

---
-- Pukku



[ Reply to This | # ]
Access FileVault sparseimages via ssh
Authored by: pukku on Mar 04, '04 12:25:04PM

OK, so I mistyped the name of the program (hdiutil or hdid). Perhaps the submit form could show the original comment?

---
-- Pukku



[ Reply to This | # ]
Access FileVault sparseimages via ssh
Authored by: tancurl on Mar 04, '04 04:12:06PM

That is a really bad idea - even if it is easier.

Putting a password on the command-line means that anyone with access to your machine will be able to capture your password by just running "ps" or some similar command that lists the active processes.



[ Reply to This | # ]
Access FileVault sparseimages via ssh
Authored by: zojas on Mar 04, '04 04:12:17PM

don't even think about doing that!! your password could be saved in your shell's history file and written in plaintext in the history file.

of course, since we're talking about mounting a filevault home here, you would probably be safe, but there's no reason to get used to leaking password's into your shell's history file.



[ Reply to This | # ]
silent mode
Authored by: mervTormel on Mar 04, '04 01:22:56PM

$ echo $0
-bash

$ read -s pw # enter password here

$ echo $pw
foobar



[ Reply to This | # ]
Access FileVault sparseimages via ssh
Authored by: bauldrywc on Mar 04, '04 05:12:25PM

Instead of mounting the images and using the terminal to find the files, set up an ssh tunnel (directly in a shell, with Fugu, or with SSH Tunnel Manager) to forward a local port to port 548 on the remote machine. Then you can just use standard Mac file sharing to access the remote volume via "Go/Connect to Server". I do this all the time to get through our university firewall to mount my office machine from home and its through ssh securely. The protected volume is decoded on the fly.

= Bill



[ Reply to This | # ]
Access FileVault sparseimages via ssh
Authored by: jago_lebow on Nov 24, '05 12:36:29PM

Where will the file mount ... on the remote machine or local ?



[ Reply to This | # ]
Access FileVault sparseimages via ssh
Authored by: Tom Robinson on Mar 19, '04 04:11:07AM
(hit control-V then Shift-Control-@), then hit Return, and then Control-D

Way too complicated!

Type your password, then Control-@, Return, Control-d.

hdiutil actually prompts you for the sequence, though it's in typical Unix parlance.

Cheers



[ Reply to This | # ]
Access FileVault sparseimages via ssh
Authored by: mynamemmy on May 08, '09 07:08:34AM

using the following commands, you can just enter your password and hit return. No need to care about how to enter the null character

( read -s pw; echo -ne "$pw\0" ) | hdiutil -stdinpass ...



[ Reply to This | # ]