Skip to content

vlauciani/guide-to-enable-ssh-on-macosx-recovery-mode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

License

Guide to enable ssh on macOSX Recovery Mode

Boot in recovery mode

Open Terminal

Go to Utility -> Terminal

Create a writeable ramdisk:

The root account has a random password. And you can’t reset it, since the filesystem is read-only. Use Pubkey authentication!

rdsize=$((16*1024*1024/512)) # 16 megabytes
dev=`hdik -drivekey system-image=yes -nomount "ram://$rdsize"`
echo $?; echo $dev # check for errors!
newfs_hfs $dev
eval `/usr/bin/stat -s /var/root` # store perms for old mountponit
mount -t hfs -o union -o nobrowse $dev /var/root # magic happens here
chown "$st_uid:$st_gid" /var/root
chmod "$st_mode" /var/root

Next, add your key to /var/root/.ssh/authorized_keys.

mkdir /var/root/.ssh
vim /var/root/.ssh/authorized_keys

Generate SSH KEY for the server

ssh-keygen -t rsa

Runs sshd

/usr/sbin/sshd -d -o UsePAM=no -h /var/root/.ssh/id_rsa

Connect from client

ssh root@<ip>

Contribute

Thanks to your contributions!

Here is a list of users who already contributed to this repository:

References

Author

(c) 2021 Valentino Lauciani vlauciani[at]gmail.com

About

Guide to enable ssh on macOSX Recovery Mode

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published