Disable SSH
apple Verified ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
I want to shut down SSH, yet I'm unable to.
Last login: Sun Dec 14 17:59:36 on console
ryans-imac-2:~ Ryan$ service ssh stop
service: failed to stop the 'ssh' service
ryans-imac-2:~ Ryan$
Please advise. Thanks.
8 replies
Sign in or join Beachball Help to reply.
- 0
Doug Niven1 ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Try:
% sudo service stop
or
% sudo -s
% service stop - 0
pianoman1976 ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Where does the 'ssh' go in these commands?
- 0
etresoft ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
System Preferences > Sharing > Remove Login > uncheck
- 0
pianoman1976 ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
I am not looking for a GUI solution, hence this question being in the Unix forum, but thanks.
- 0
Doug Niven1 ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Oops!
I meant:
% sudo service ssh stop
or
% sudo -s
<enter admin password>% service ssh stop
- 0
pianoman1976 ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
The '%' symbol didn't work. I'm unfamiliar with that.
Anyway, what did take was 'sudo service ssh stop'
So thanks for that!
Does this permanently disable SSH, even after restart?
How do I check SSH status to confirm it's disabled?
Thanks!
- 0
Nils C. Anderson ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
To check that it is disabled, ( the dollar sign below represents the command line prompt, and doesn't need to be entered)
$ service --test-if-configured-on ssh
$ echo $?
1man 8 service
--test-if-configured-on service
Exit with status 0 if the service is currently enabled. Otherwise, exit with status 1. - 0
etresoft ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
I just troll "Mac OS X Technologies" and those questions are usually the ones most interesting. I thought perhaps you didn't know that "Remote Login" and SSH were the same thing.
However, since they are the same thing, the GUI is a good place to start. The file you want to look at is /System/Library/LaunchDaemons/ssh.plist. When the GUI setting is unchecked, that file has a
<key>Disabled</key>
<true/>added to it. When you check "Remote Login", that Disabled key is removed and sshd is started up. Once the disabled key is gone, you can control sshd from the command line via the normal "sudo launchctl load/unload/start/stop" commands.
You can poke around in that file and start sshd on your own, but it would be better to work within the launchd framework and associated GUI.