12

I am trying to find a way of turning on SSH through terminal, instead of opening settings and turn it on that way. Or perhaps a way to turn SSH on by running a .pkg file?

I am running OS X Lion, but it would be great if it also worked on Snow Leopard!

11

enable remote login

systemsetup -setremotelogin on

disable remote login

systemsetup -setremotelogin off
  • Can i allow it for a specific user via terminal? – user389393 Nov 13 '14 at 9:04
5

You may have to sudo:

    sudo systemsetup -setremotelogin on
2

I've found terminal WILL ask:

Do you really want to turn remote login off? If you do, you will lose this connection and can only turn it back on locally at the server (yes/no)?

Typing 'yes' in scripts is not always possible. To resolve this, use a -f flag before -setremotelogin, like so:

systemsetup -f -setremotelogin on
systemsetup -f -setremotelogin off
  • Actually, it's needed enough that most *nix systems come with yes. – Kasisnu Dec 7 '16 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.